From 604154f414c344c222f4f1009bbea1283127c4d4 Mon Sep 17 00:00:00 2001
From: aftercase <74765798+aftercase@users.noreply.github.com>
Date: Tue, 13 Jul 2021 00:22:46 +0100
Subject: [PATCH] checkFavorite PDO
Cant get working.
---
includes/functions.php | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/includes/functions.php b/includes/functions.php
index e92638c..0d250f3 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -38,17 +38,19 @@ function CountPasteFavs($conn, $fav_id) {
return $query->fetchAll();
}
-
-function checkFavorite($paste_id, $user_id, $conn) {
- $result = $conn->query("SELECT * FROM pins WHERE m_fav = '" . $user_id . "' AND f_paste = '" . $paste_id . "'");
+//Can't seem to get working.
+function checkFavorite($conn,$paste_id, $user_id) {
+ $result = $conn->query("SELECT * FROM pins WHERE m_fav = ? AND f_paste = ?");
+ $query->execute([$user_id,$paste_id]);
$numrows = $result->num_rows;
- if ($numrows == 0) {
- echo "";
+ if ($numrows) {
+ return "";
} else {
- echo "";
+ return "";
}
}
+
function getreports($conn, $count = 10) {
$query = $conn->prepare('SELECT * FROM user_reports LIMIT ?');
$query->execute([$count]);