Code: Select all
$query = $db->execute("select `id`, `username`, `avatar` from `players` ?");
if ($player->avatar == 0)
{
echo "No avatar";
}
else
{
echo "YES!";
}
?>
Several problems here:
1. Why is there a ? at the end of your SQL query?
2. How are you getting from $query holding the result of the database query to $player being an object holding content from a row in $query? Without knowing which database abstraction layer you're using I can't give you the code to get the row, but if it was ADODB or ADODB Lite you'll need "$player = $query->FetchNextObj();".
3. Instead of just outputting no or yes, output $player->avatar as well. Eg
Code: Select all
echo "No avatar: ".$player->avatar;
If it's not empty then you'll see what it contains.
It is empty mind you, the problem is to do with the query I reckon, otherwise your script would echo Yes.