i cant destroy the session that i have created it come up with the following errors
Notice: Undefined variable: _SESSION in C:\Program Files\Apache Group\Apache2\htdocs\cafe2\13\Circle2\final.php on line 9
Notice: Undefined variable: _SESSION in C:\Program Files\Apache Group\Apache2\htdocs\cafe2\13\Circle2\final.php on line 11
Notice: Undefined variable: _SESSION in C:\Program Files\Apache Group\Apache2\htdocs\cafe2\13\Circle2\final.php on line 11
Warning: session_destroy(): Trying to destroy uninitialized session in C:\Program Files\Apache Group\Apache2\htdocs\cafe2\13\Circle2\final.php on line 15
the script is below
<?php
$approved = 'Y'; // Practice
require_once ('../mysql_connect.php'); // Connect to the database.
// Turn the cart into a database-safe version.
$c = addslashes (serialize($_SESSION['cart']));
$query = "INSERT INTO orders (customer_id, total, order_date, approved, cart) VALUES ({$_SESSION['cid']}, {$_SESSION['total']}, NOW(), '$approved', '$c' )";
$result = mysql_query ($query);
$_SESSION = array(); // Destroy the variables.
session_destroy(); // Destroy the session itself.
if ($approved == 'Y') {
// Send an email.
echo '<p>Thank you for your order!</p>';
} else {
echo '<p>Your order could not be placed!</p>';
}
mysql_close();
?>
can't destroy session
Moderator: General Moderators
-
the_NEWBIE_ON_THE_BLOCK
- Forum Newbie
- Posts: 1
- Joined: Sat Feb 28, 2004 6:20 am
You must have
At the top of everypage. That might be the problem
Code: Select all
<?
session_start();
?>