This is my error:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 53 in C:\xampp\htdocs\includes\class.rooms.php on line 35
This is the line in the coding:
return mysql_result(
dbquery(
"SELECT " . $var . " FROM rooms WHERE id = '" . $roomId . "' LIMIT 1"
), 0);
Firstly, function dbquery is unfamiliar to me. I know mysql_query, but maybe it's your own method. The problem is, most possibly, that your query returns no rows. Try debugging with
$result = ..query..
if (!mysql_num_rows($result))
echo "No rows.";
Assuming that $var and $roomId are correctly populated , it might he useful to test your code excluding the dbquery function which seems to be a user defined function :
$query_temp = "SELECT " .$var ." FROM rooms WHERE id = '" .$roomId ."' LIMIT 1";
/*
* This is for test purpose and in production you would not want to display neither the query nor error to the user.
*/
$result_temp = mysql_query( $query_temp ) or die ("Error in query: $query_temp. " .mysql_error( ) );
// var_dump( mysql_fetch_array ( $result_temp ) );
return( $result_temp );
As already commented by shmuli it is worth to switch to mysqli or pdo in the beginning itself