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!
$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'];
?>
But it doesnt echo anything and when I try to use the $_SESSION['Job_ID'] variable nothing is returned. Can someone please help.
But it doesnt echo anything and when I try to use the $_SESSION['Job_ID'] variable nothing is returned. Can someone please help.
you mean to say, on the other pages where you want to use this job id, you set the session job id, which already has a value, to the var job id, which has nothing, and then you echo session id, and expect something.
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']))
{
[color=#FF0000] $_SESSION['Job_ID']=$Job_ID;[/color]
$Job_ID = $_SESSION['Job_ID'];
}
echo $_SESSION['Job_ID'];
?>