Hi all

I didn't get that many replies (thanks to those who did reply :) ) for this,
so now I've figured out the problem I thought I'd share the solution just in
case anyone else has the same issue:

<solution>
The problem stemmed from the way the return from UPDATE is handled and the
scripts reliance on the mysql_affected_rows() command

If the UPDATE command is executed on a record and no values are altered the
command exits with a value of 0 meaning that the result of
mysql_affected_rows() is false

This occurs on redirects and fast refreshes because the time value hasn't
changed so no values are altered in the row, mysql_affected_rows() is false
and the function continues as no condition is met to return a value... the
following INSERT then causes the problem

The solution was do execute a simple SELECT to get the number of rows for
the session ID and if mysql_affected_rows() evaluated to false but the
number of records is 1 return true
</solution>

And there we have it... nearly drove me nuts but I got there in the end

Cheers

Dan
-----------------------------------------------------
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-----Original Message-----
From: Dan Parry [mailto:[EMAIL PROTECTED] 
Sent: 16 February 2006 09:51
To: php-general@lists.php.net
Subject: [PHP] Session problems

Hi all

 

I've been getting an error while using a custom session handler utilising a
MySQL database

 

The error I receive is:

 

Duplicate entry '<<PHPSESSID_REMOVED>>' for key 1
Warning: Unknown(): A session is active. You cannot change the session
module's ini settings at this time. in Unknown on line 0

 

I've contacted my hosting company regarding this but currently they don't
seem to know the cause

 

I've Googled but I can't find anything I can use

 

Thanks in advance :-)

 

Dan

 

-----------------------------------------------------

Dan Parry

Senior Developer

Virtua Webtech Ltd

http://www.virtuawebtech.co.uk

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to