fixed functions

getUserFavs & CountPasteFavs now actually work.
This commit is contained in:
aftercase 2021-07-13 00:21:21 +01:00
parent 60fa6fe5fe
commit 80484559e5

View file

@ -27,13 +27,13 @@ function timer() {
}
function getUserFavs($conn, $username) {
$query = $conn->prepare("SELECT pins.f_time, pins.m_fav, pins.f_paste, pastes.id, pastes.title, pastes.now_time, pastes.tagsys FROM pins, pastes WHERE pins.f_paste = pastes.id AND pins.m_fav=?'");
$query = $conn->prepare("SELECT pins.f_time, pins.m_fav, pins.f_paste, pastes.id, pastes.title, pastes.now_time, pastes.tagsys FROM pins, pastes WHERE pins.f_paste = pastes.id AND pins.m_fav=?");
$query->execute([$username]);
return $query->fetchAll();
}
function CountPasteFavs($conn, $fav_id) {
$query = $conn->prepare("SELECT COUNT(f_paste) FROM pins WHERE f_paste=?");
$query = intval($conn->prepare("SELECT COUNT(f_paste) FROM pins WHERE f_paste=?"))->fetch(PDO::FETCH_NUM)[0]);
$query->execute([$fav_id]);
return $query->fetchAll();
}