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"? 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 } ?> 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 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
Archived
This topic is now archived and is closed to further replies.