Problem with ending a session
Hi,
I have set up the checkout_success page to sent a confirmation mail.
When I place a new order, the order number on the success page increases by one, however the order number of the confirmation mail does not. For example the new order no. shown in the browser is 130. The order number shown in the confirmation mail is 125. If I order three items, the confirmation mail shows three lines, but the item displayed is from order no. 125. Yesterday the numbers for the confirmation mail stayed at the same number, this morning, the number was correct, but now stays at the first order number of today.
I suspect, that the session is somewhat ended, but not entirely (if that is possible).
After the html tag this code is added:
<?php
mysql_free_result($rsorders);
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
session_start();
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
@setcookie(session_name(), '', time()-42000, '/');
}
// Finally, destroy the session.
session_destroy();
?>
Do I need to make a change to this code? Or what else could be wrong?
Any help would be very much appreciated.