I execute a mysql_query searching for a 'specific' record. The record is not found (I purposely choose an invalid ID) yet the query returns a result. What does this result point to, and why is there any result returned?
ex:
$custid = '250';
$sql_select = "select * from cust_detail where cust_detail.custid = \"$custid\" " ;
$result = mysql_query($sql_select) or die("failed: . mysql_error()");
Should this not take the 'failed' route?
When executed it returns a result set of "Resource ID #4". But any subsequent mysql_fetch_array($result) returns nothing. So what's up with that? If you can't rely on a failed query to 'fail', then how would you ever know?
I'm fairly new to mysql and php and I certainly have only a minimal understanding of the concepts. Maybe someone could clue me in on what to expect, and how to handle this type of occurrence. All the manuals I've read really don't expound on this situation.
Any clarification would be greatly appreciated.
JP
ex:
$custid = '250';
$sql_select = "select * from cust_detail where cust_detail.custid = \"$custid\" " ;
$result = mysql_query($sql_select) or die("failed: . mysql_error()");
Should this not take the 'failed' route?
When executed it returns a result set of "Resource ID #4". But any subsequent mysql_fetch_array($result) returns nothing. So what's up with that? If you can't rely on a failed query to 'fail', then how would you ever know?
I'm fairly new to mysql and php and I certainly have only a minimal understanding of the concepts. Maybe someone could clue me in on what to expect, and how to handle this type of occurrence. All the manuals I've read really don't expound on this situation.
Any clarification would be greatly appreciated.
JP