runnerjp Posted February 10, 2010 Share Posted February 10, 2010 Hey guys, Im setting up my get to check if it comes with 5 diff outcomes. ( for this purpose i will use 1 to test it) If ($_GET['forum']== 'General') {$forum=$_GET['forum'];} else {$forum='null';} how could i add this rule to $data = mysql_query("Select * from forumtutorial_posts where parentid='0' AND forum = '$forum' ORDER BY important, lastrepliedto")or die("Could not get users"); $rows = mysql_num_rows($data); so that if forum = null i can throw up an error page saying this forum doesnot exsist or something of that lines. If there is an easyer way to do this im open to suggestions but this is the only way i can think of atm $_get Link to comment https://forums.phpfreaks.com/topic/191636-using-get-and-having-only-5-possible-outcomes/ Share on other sites More sharing options...
Catfish Posted February 10, 2010 Share Posted February 10, 2010 dont really get what youre on about... there's a few ways i could understand your post due to poor spelling / bad grammar so here goes... "how could i add this rule to" (how can i add a condition for this line of code also?) If ($_GET['forum']== 'General') {$forum=$_GET['forum'];} elseif ($data = mysql_query("Select * from forumtutorial_posts where parentid='0' AND forum = '$forum' ORDER BY important, lastrepliedto")or die("Could not get users")) {$rows = mysql_num_rows($data);} else {$forum='null';} "so that if forum = null i can throw up an error page saying this forum doesnot exist or something" else { $forum = 'null'; include('forumDoesNotExistPage.php'); // load a php file to display HTML that forum does not exist print('That forum does not exist. Go back and select a real one.<br/>'."\n"); // output a message to the user the forum does not exist } Link to comment https://forums.phpfreaks.com/topic/191636-using-get-and-having-only-5-possible-outcomes/#findComment-1010189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.