mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
checkFavorite PDO
Cant get working.
This commit is contained in:
parent
80484559e5
commit
604154f414
1 changed files with 8 additions and 6 deletions
|
@ -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 "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='" . $paste_id . "'><i class='far fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
if ($numrows) {
|
||||
return "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='" . $paste_id . "'><i class='far fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
} else {
|
||||
echo "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='" . $paste_id . "'><i class='fas fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
return "<a href='#' id='favorite' class='iconn tool-iconn' data-fid='" . $paste_id . "'><i class='fas fa-star fa-lg has-text-grey' title='Favourite'></i></a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getreports($conn, $count = 10) {
|
||||
$query = $conn->prepare('SELECT * FROM user_reports LIMIT ?');
|
||||
$query->execute([$count]);
|
||||
|
|
Loading…
Add table
Reference in a new issue