Session() help needed...please
Posted: Tue Mar 17, 2009 12:11 pm
HI guys, I am assigning my session like this:
But it doesnt echo anything and when I try to use the $_SESSION['Job_ID'] variable nothing is returned. Can someone please help.
Code: Select all
$sql="SELECT * FROM Job_ID WHERE Job_Name='$projectname'";
$result = mysql_query($sql) or die ("Couldn't execute query.");
while ($row=mysql_fetch_array($result))
$Job_ID=$row['Job_ID'];
{
if(isset($_POST['Job_ID']))
{
$_SESSION['Job_ID']=$Job_ID;
}
}
[code]
and at the top of this page I have session_start();.
On the other pages, where I want to use this job id variable I have got:
[code=php]
<?php
session_start();
if(isset( $_SESSION['Job_ID']))
{
$_SESSION['Job_ID']=$Job_ID;
}
echo $_SESSION['Job_ID'];
?>