ID: 50642 Updated by: johan...@php.net Reported By: nakulgoud at gmail dot com -Status: Open +Status: Bogus Bug Type: *Database Functions Operating System: Windows XP SP2 PHP Version: 5.3.1 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. our check for if (!$result) checks whether the query was successfulwhichit was, as it returned a reslt set of 0 elements. You might use mysql_num_rows() to see how many rows there are, while in general it's better to use mysql_fetch() instead of mysql_result(). Please also note that the mysqli extension offers support for MySQL features and is the suggested way to talk to MySQL. Previous Comments: ------------------------------------------------------------------------ [2010-01-03 12:54:08] nakulgoud at gmail dot com Description: ------------ After exection of query where mysql returns an empty set then 'if($result)' returns true.It should return false.How to handle this situation. Reproduce code: --------------- --- >From manual page: function.mysql-fetch-row#Examples --- $query="select name from user where id=42'"; $result=mysql_query($query); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $data = MYSQL_RESULT($result,0,"id"); Expected result: ---------------- Could not run query : No such row in database. Actual result: -------------- Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in C:\wamp\www\all is well\signin.php on line 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50642&edit=1