insert statements

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
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

insert statements

Post by nikko50 »

Hi there. I have an include statement that is conflicting with my program. In the statement below you can see if I comment out the include statement the IF statements work. If I place the include statement back into the program the IF statements don't calculate anything and the program continues. I need some help. Why is this happening???

if(!$getuserline[realname])
{
header("Location: login.php");
}
else
// {
// include ("navibar.inc.php");
//
// }

if($radiogo =="insert")
{
header("Location: shipsingle.php");

}
elseif($radiogo =="update")
{
header("Location: static.php");

}
elseif($radiogo =="viewall")
{
$query= "SELECT * FROM shiplist WHERE quantity > 0 AND store = '$store' ORDER BY date";
mysql_query($query) or print(mysql_error());
$getstorearray=mysql_fetch_array($query, MYSQL_ASSOC) or print(mysql_error());
echo $getstorearray;

}
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

what is this??

if(!$getuserline[realname])
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Hi there. That tests a session register.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Try putting exit; after all your headers', eg

header("Location: login.php");
exit;
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Hi there. Thanks for the response. I tried that but it does'nt work. The if statements are still skipped.
Sharon :(
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Does navibar.inc.php output anything? If so then you won't be able to do any header("Location's after it as you can redirect using header after output has been sent.
Try putting error_reporting(E_ALL) at the very top of the script, it will throuw out alot of warning that you should fix, such as doing if(!$getuserline[realname]) .. it will warn you about an undefined constant as it expects you to use $getuserline['realname'] .. and it might also highlight where the problem is.
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Hi again. Thanks for the help!! navibar.inc.php outputs a navigation bar at the top of the page.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Then none of the header Locations following the include will work as you've sent output.
Post Reply