erme Posted January 19, 2010 Share Posted January 19, 2010 Hi, I currently have something like this: /company.php?county=devon but if, say, a user manually puts something like this in /company.php?county=devvvon I want it to display a message (possibly re-direct to another page) saying "County does not exist" Link to comment https://forums.phpfreaks.com/topic/189045-simple-error-message-if-not-in-database/ Share on other sites More sharing options...
Lamez Posted January 19, 2010 Share Posted January 19, 2010 $q = mysql_query("SELECT * FROM table WHERE name = '$name'"); $n = mysql_num_rows($q); if($n > 0){ echo $name; }else{ echo $name." not found."; } Link to comment https://forums.phpfreaks.com/topic/189045-simple-error-message-if-not-in-database/#findComment-998140 Share on other sites More sharing options...
erme Posted January 19, 2010 Author Share Posted January 19, 2010 Wow that simple! I feel like an idiot now, been pulling my hair out for past 2 hours! Thanks mate!!! Link to comment https://forums.phpfreaks.com/topic/189045-simple-error-message-if-not-in-database/#findComment-998146 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.