I know this question was asked a number of times but none of the solutions worked for me.
I am able to set sessions but the problem is that, for some reason, when my session is not set it keeps saying your session is set.
This is my piece of code:
session_start();
if($_SESSION["GOALOLD"]=="GOALOLDVALS") {
//echo $_SESSION['GOALOLD'];
$prog_descs = "";
$sel_prog_descs = "SELECT * FROM prog_description WHERE cons_id = '" . $_SESSION['behaviour_user'] . "' AND prog_id = '" . $_SESSION['prog_id'] . "' AND student_id = '" . $_SESSION['current_student'] . "' ORDER BY prog_desc_id DESC LIMIT 1";
$sel_prog_dessc = mysql_query($sel_prog_descs) or die(mysql_error());
if (mysql_num_rows($sel_prog_dessc) > 0) {
$rs_prog_dessc = mysql_fetch_array($sel_prog_dessc);
$prog_descs = $rs_prog_dessc['prog_goal_con'];
}echo $prog_descs;
}else if($_SESSION["GOALNEW"]=="GOALNEWVALS") {
//echo $_SESSION['GOALNEW'];
$prog_descs = "";
$sel_prog_descs = "SELECT * FROM prog_description WHERE cons_id = '" . $_SESSION['behaviour_user'] . "' AND prog_id = '" . $_SESSION['prog_id'] . "' AND student_id = '" . $_SESSION['current_student'] . "' ORDER BY prog_desc_id DESC LIMIT 1";
$sel_prog_dessc = mysql_query($sel_prog_descs) or die(mysql_error());
if (mysql_num_rows($sel_prog_dessc) > 0) {
$rs_prog_dessc = mysql_fetch_array($sel_prog_dessc);
$prog_descs = $rs_prog_dessc['prog_goal_con'];
}
echo $prog_descs;
}else{
}
Here is how I am unsetting my sessions:
unset($_SESSION['GOALOLD']);
unset($_SESSION['GOALNEW']);
Is there a reliable and proper way to check the session, whether it is set or not, or has some xyz value in it?
For me, they are not working.
I have even tried in another browser but still get the same problem where it keeps saying it is set. Possibly my if else
is buggy or has technical issues; I am not sure.