Help with non functioning IF statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
braatenj
Forum Newbie
Posts: 2
Joined: Fri May 07, 2010 10:06 am

Help with non functioning IF statement

Post by braatenj »

Ok, so I am just playing around a little bit trying to learn PHP & MySQL and I am trying to create a very small forums, now the bulk of the forum code is run from IF statements in the index.php file. Now I have these two IF statements

Code: Select all

if ($fid == ''){
//show the different forums
} elseif ($fid != '' && act =='0'){
//show the posts in the selected forum
}
now when the page is first viewed it shows the different forums, which it is supposed to do, however when you click the link for one of the forums and the url reads index.php?fid=1&act=0 it is still executing the code inside the first IF statement instead of the second one, I don't understand why it is not behaving the way it is intended to, any help would be appreciated.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Help with non functioning IF statement

Post by AbraCadaver »

Code: Select all

echo $fid;
echo $acct;
Then read up on http://www.php.net/manual/en/reserved.variables.get.php

While learning you need this:

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', '1');
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
braatenj
Forum Newbie
Posts: 2
Joined: Fri May 07, 2010 10:06 am

Re: Help with non functioning IF statement

Post by braatenj »

Ahh, I thought that the variables that were passed through the links where automagically recognized with their corresponding name, didn't realize I had to $_GET them first :)
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Help with non functioning IF statement

Post by AbraCadaver »

braatenj wrote:Ahh, I thought that the variables that were passed through the links where automagically recognized with their corresponding name, didn't realize I had to $_GET them first :)
http://php.net/manual/en/security.globals.php
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply