Hi guys.I've got a problem.I'm building my php browsergame and i'm stuck into the inventory page.I have a code that seems ok to me but it won't work.Here it is:
$inventory = array();
$query = sprintf("SELECT id, item_id, quantity FROM user_items WHERE user_id = '%s'",
mysql_real_escape_string($userID));
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
$item_query = sprintf("SELECT name FROM items WHERE id = '%s'",
mysql_real_escape_string($row['item_id']));
$item_result = mysql_query($item_query);
list($row['name']) = mysql_fetch_row($item_result);
array_push($inventory,$row);
}
I've spotted the problem.The $inventory array is empty.I checked it with if(empty($inventory)) .Thanks in advance and keep in mind that I'm a noob yet.