This topic is locked

If Then Syntax ??

1/30/2010 1:27:51 AM
PHPRunner General questions
L
lewisekrantz author

echo $_SESSION["UserID"];
if ($_SESSION["UserID"] = "johnsmith")

{

// header("location: http://www.google.com";);

// exit();

echo $_SESSION["UserID"];

}
==========================================================================

Line 1 echos the CORRECT Login User id

Line 2 is supposed to test for that user ID and do something for a particular user,

but it is really just setting the userid to Johnsmith" rather than testing for it
Can you give me some direction ???

A
aalekizoglou 1/30/2010

Hi,
correct usage is ==
if ($_SESSION["UserID"] == "johnsmith")