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. Link to comment https://forums.phpfreaks.com/topic/58728-solved-a-newbie-qns/ 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!? Link to comment https://forums.phpfreaks.com/topic/58728-solved-a-newbie-qns/#findComment-291303 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.."; Link to comment https://forums.phpfreaks.com/topic/58728-solved-a-newbie-qns/#findComment-291305 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) Link to comment https://forums.phpfreaks.com/topic/58728-solved-a-newbie-qns/#findComment-291312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.