I have a PHP function that is giving me the following error message:
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\includes\stat.php on line 10.
The function works perfectly and displays everything, so I don't know why I'm getting this warning. I've been messing with it for an hour now with no luck.
My function code is as follows.
function getStat($stat,$name) {
include 'includes/config.php';
$conn = mysql_connect($dbhost,$dbuser,$dbpass)
or die ('Error connecting to mysql:');
mysql_select_db($dbname);
$query = sprintf("SELECT $stat FROM players WHERE username = '%s'",
mysql_real_escape_string($_SESSION['username']));
$result = mysql_query($query);
------>list($value) = mysql_fetch_row($result);<-------------------line throwing warning
return $value;
}