I have a $_SESSION id’s of an item
for example i have this items
$_SESSION['items'] = array(1,4,5,7,8);
and I have a data from database
$query = mysql_query("SELECT * FROM items");
while($row = mysql_fetch_array($query)){
// Here in the loop; I want to Search
// $row['id'] if exist in $_SESSION['items']
// if exist I want to display 'YES' else 'NO'
}
How to do the right code for this ?
Thank you for any help.
using
in_arrayhttps://www.php.net/in_array