Jump to content

Using $get and having only 5 possible outcomes


runnerjp

Recommended Posts

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

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
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.