marco839 Posted September 20, 2007 Share Posted September 20, 2007 This is totally over my head.. I use a command to load details from a database through the below way: file.php?id=1 - loads record [id] #1 from database file.php?id=2 - loads record [id] #2 from database file.php?id=3 - there is no record in the database with this number How can I have either id=4, 5, 6.. etc to come up with a error page saying "sorry, we have no record"? Quote Link to comment https://forums.phpfreaks.com/topic/70050-solved-when-get-cannot-find-anything-in-the-database/ Share on other sites More sharing options...
pocobueno1388 Posted September 20, 2007 Share Posted September 20, 2007 You just check if the query returned any results. <?php if (mysql_num_rows($query) < 1){ echo "Sorry we have no record"; } else { //code to display record data goes here } ?> Quote Link to comment https://forums.phpfreaks.com/topic/70050-solved-when-get-cannot-find-anything-in-the-database/#findComment-351795 Share on other sites More sharing options...
marco839 Posted September 20, 2007 Author Share Posted September 20, 2007 Brill.. thanks very much Quote Link to comment https://forums.phpfreaks.com/topic/70050-solved-when-get-cannot-find-anything-in-the-database/#findComment-351817 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.