query("SELECT * FROM config WHERE name = \"lastUpdated\""); $getlast3 = $getlast->fetch_assoc(); $last = $getlast3['value']; if ($last != date('md')) { $getpending = $mysql_conn->query("SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1"); $getpending3 = $getpending->fetch_assoc(); if (!empty($getpending3)) { $id = next_comic_id(); $setcomic = $mysql_conn->prepare("UPDATE comics SET status = \"publish\", comic_id = ? WHERE id = ?"); $setcomic->bind_param("ii", $id, $getpending3['id']); $setcomic->execute() or die($setcomic); $insmeta = $mysql_conn->prepare("INSERT INTO meta (comic_id,name,value) VALUES (?,\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")"); $insmeta->bind_param("i", $getpending3['id']); $insmeta->execute() or die($insmeta); $setconfig = $mysql_conn->prepare("UPDATE config SET value = ? WHERE name = \"lastUpdated\""); $newdate = date('md'); $setconfig->bind_param("s", $newdate); $setconfig->execute(); } } ?>