From 4465f607669a229728153e745a6b6d4a8ea02d8e Mon Sep 17 00:00:00 2001 From: aftercase <74765798+aftercase@users.noreply.github.com> Date: Sun, 11 Jul 2021 20:29:57 +0100 Subject: [PATCH] update functions Missed mothpop function --- includes/functions.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index d0b8a1c..974410a 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -136,13 +136,12 @@ function recentupdate($conn, $count) { return $query->fetchAll(); } - -function monthpop($conn, $count = 10) { - $limit = $count ? "limit $count" : ""; +//Cannot get this to work. +function monthpop($conn, $count) { $p_month = date('F'); - $query = "SELECT s_date, views, title, id, now_time, visible, tagsys, member FROM pastes WHERE s_date LIKE '% $p_month %' AND visible = '0' ORDER BY views + 0 DESC LIMIT 10, $count"; - $result = mysqli_query($conn, $query); - return $result; + $query = $conn->prepare("SELECT s_date, views, title, id, now_time, visible, tagsys, member FROM pastes WHERE s_date LIKE ? AND visible = '0' ORDER BY views + 0 DESC LIMIT 10, ?"); + $query->execute([$p_month,$count]); + return $query->fetchAll(); }