I have a issue with the code below what I am trying to get the image from gifts table with matching the user_gifts id with the gifts_id but can not seam to get it right anyone god any ideas thanks.
public function get_my_gifts($user_id) {
global $db;
$my_gifts = [];
$get_my_gifts = $db->query(sprintf("SELECT gifts.image FROM users_gifts INNER JOIN gifts ON `users_gifts`.gift_id = `gifts`.gift_id WHERE users_gifts.to_user_id = %s", secure($user_id, 'int') )) or _error("SQL_ERROR_THROWEN");
if($get_my_gifts->num_rows > 0) {
while($my_gift = $get_my_gifts->fetch_assoc()) {
$my_gifts[] = $my_gift;
}
}
return $my_gifts;
}
Yours
Simon