Hello!
I have a feature in my webstie that the users can receive items.
I have a table with the list of items and what’s the user_id they are belong to - very simple table:
id | user_id | item_id
Sometimes the user may receive an item.
My problem is, that the user can’t get the SAME item twice.
so I need to change this query:
$getrandom = mysql_fetch_assoc(mysql_query('SELECT id,name FROM `items` ORDER BY RAND()'));
which gives a random item from all items, instead picking ONLY the items the user don’t have (check in the user-item table if he got the item).
I need to filter the items this user has already got. the user id is storred in my session as $_SESSION[‘id’].
Looking for assistance with this. Thanks in advance!