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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.