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" Quote 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."; } Quote 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!!! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.