I've been trying to use extract() and mysql_fetch_array to get two variables from one row in the table with a query that seems to be fine:
$query = "SELECT char_level, race FROM characters WHERE id='$id'";
$result = mysql_query ($query, $link) or die("Query error: " . mysql_error());
if(mysql_num_rows($result)){
$array == mysql_fetch_assoc($result) or die("Row fetching error: " . mysql_error());
extract($array);
}
When I type the select statement on a command line, it returns the two cells as expected, but mysql_num_rows insits it returns nothing. No query or row fetching errors have turned up when I leave off the mysql_num_rows check, just the error that extract() is not receiving an array.
I'm sure I'm missing something simple, since it's a fairly simple task, but I can't seem to come up with any good reason for it to behave this way.
Thanks in advance,
Reha