light85 Posted July 6, 2007 Share Posted July 6, 2007 Hi, I have a search database, the user just provide the ID and the system will show the records. I would like to know what value will PHP/MySQL return if the ID provided is not in the database? Currently my system will only show the HTML code as there is nothing to display by PHP/MySQL when a ID is not found. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 6, 2007 Share Posted July 6, 2007 Not sure what you mean by show the ID is it isn't in the database? Surely if it isn't there it can't be shown!? Quote Link to comment Share on other sites More sharing options...
melvincr Posted July 6, 2007 Share Posted July 6, 2007 of course.. if it's not found.. it can't give you anything.. you have to handle this case by yourself like $result = mysql_query("SELECT * FROM table1"); $num_rows = mysql_num_rows($result); if(!$num_rows) echo "nothing here.."; Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 6, 2007 Share Posted July 6, 2007 I understand now - it returns FALSE (which is effectively zero) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.