Hi
I have the following code and what I am trying to do is to set a SESSION variable from my QUERY for sales_person which also resides in the SALES table.
However, when I test for the existence of the variable elsewhere it doesn't seem to have been set. Have I got incorrect syntax for setting the variable?
I have the following code and what I am trying to do is to set a SESSION variable from my QUERY for sales_person which also resides in the SALES table.
However, when I test for the existence of the variable elsewhere it doesn't seem to have been set. Have I got incorrect syntax for setting the variable?
Code:
<?
session_start();
include("conn.php");
$s_password = $_POST['s_password'];
$s_username = $_POST['s_username'];
$query = "select * from sales
WHERE s_username = '$s_username'
AND s_password = '$s_password'";
$result = mysql_query($query) or die (mysql_error());
if(mysql_numrows($result) < 1)
{
include("HeaderLogin.htm");
}
else
{
session_start();
$sales_person = $result['sales_person'];
$_SESSION['Logged_In'] = "True";
$_SESSION['s_password'] = $s_password;
$_SESSION['sales_person'] = $sales_person;
echo "<script>document.location.href='listaccessorders.php'</script>";
}
?>