From 459e929311d8806f604c0b914ba4b37aa731fbfc Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 8 Jan 2024 21:09:05 +0000 Subject: Migrated to mysqli --- includes/update.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'includes/update.php') diff --git a/includes/update.php b/includes/update.php index 6c8d9ff..3f2fae1 100755 --- a/includes/update.php +++ b/includes/update.php @@ -1,27 +1,29 @@ query("SELECT * FROM config WHERE name = \"lastUpdated\""); +$getlast3 = $getlast->fetch_assoc(); $last = $getlast3['value']; if ($last != date('md')) { - $getpending = "SELECT * FROM comics WHERE status = \"pending\" ORDER BY id ASC LIMIT 0,1"; - $getpending2 = mysql_query($getpending); - $getpending3 = mysql_fetch_array($getpending2); + $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 = "UPDATE comics SET status = \"publish\", comic_id = " . $id . " WHERE id = " . $getpending3['id']; - $setcomic2 = mysql_query($setcomic) or die($setcomic); + $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 = "INSERT INTO meta (comic_id,name,value) VALUES (" . $getpending3['id'] . ",\"pubDate\",\"" . date('Y-m-d H:i:s') . "\")"; - $insmeta2 = mysql_query($insmeta) or die($insmeta); + $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 = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdated\""; - $setconfig2 = mysql_query($setconfig); + $setconfig = $mysql_conn->prepare("UPDATE config SET value = ? WHERE name = \"lastUpdated\""); + $newdate = date('md'); + $setconfig->bind_param("s", $newdate); + $setconfig->execute(); } } -- cgit 1.4.1