I have started a session in a shopping cart as below:
THIS IS IN db.php FILE
I am trying to destroy the session using the code below:
THIS IS IN THE ThankYou.php FILE RIGHT AT THE END
And the following message gets generated:
Does the value of the session have to be passed from db.php to ThankYou.php?
If so, how? Or is there another mistake?
Thanks.
THIS IS IN db.php FILE
Code:
<?php
$dbServer = "localhost";
#$dbUser = "aff_ffsc";
$dbUser = "k";
$dbPass = "xxxxx";
$dbName = "aff_art";
function ConnectToDb($server, $user, $pass, $database){
$s = @mysql_connect($server, $user, $pass);
$d = @mysql_select_db($database, $s);
if(!$s || !$d) return false; else return true;}
function GetCartId(){ if(isset($_COOKIE["cartId"])) {
return $_COOKIE["cartId"];} else
{
session_start();
setcookie("cartId", session_id(), time() + ((3600 * 24) * 30), "/", ".hosting.com",1);return session_id();}}
?>
I am trying to destroy the session using the code below:
THIS IS IN THE ThankYou.php FILE RIGHT AT THE END
Code:
session_unset();
session_destroy();
MySQL_close();
And the following message gets generated:
Code:
Warning: session_destroy(): Trying to destroy uninitialized session in ThankYou.php on line 297
Does the value of the session have to be passed from db.php to ThankYou.php?
If so, how? Or is there another mistake?
Thanks.