Warning: mysql_result(): Unable to jump to row 0 on MySQL
I want to select an id from a table using the query:
$demo_id = mysql_result(mysql_query("SELECT id FROM demo_tbl WHERE a_val='a' and b_val='b' LIMIT 1"),0);
This query works perfectly if it satisfies the condition. But if there is no such record then the above mentioned error shows. I dont want to use mysql_num_rows(). Is there any way to find whether $demo_id has value or not.