$query = "DELETE FROM sessions WHERE sessionID=$sessionID"; echo "$query\n"; $result = mysql_query($query);
If it looks right, copy the query and paste it into the mysql client. At the least, you will determine whether it is the query or something PHP does with the query that is at fault.
If the query turns out to be correct, we'll have to look elsewhere. In that case, you should include your platform/OS and versions of mysql and PHP in your next post. Also, tell us whether sessions is a MyISAM or InnoDB table.
One more thought: Is there any possibility that your script is creating the record on one server but updating/deleting it on another? Perhaps production and development copies of mysql?
Michael
Margaret MacDonald wrote:
It's possible that this is more a php question than a mysql question, but since the two are so nearly joined at the hip, I'm hoping someone can advise anyhow.
I'm developing a php job that uses a table 'sessions' to maintain a
logical session across pages and physical sessions. It's a simple
table, with only 3 fields: the session id, a timestamp recording the
last write, and a text field for the data.
To purge the session record, the user needs to explicitly log out. When they click the logout button, it calls a logout routine that calls mysql_query ( DELETE FROM sessions WHERE sessionID= the session identifier. ) .
But, when I test that, the DELETE doesn't actually work the way I
would expect it to do. Inspecting the table with the mysql
command-line console, I can still see the record itself with the
session id and the timestamp seemingly unchanged, though the data
field appears to be zeroed out.
Php seems to think the record's been deleted, though, because an
attempted read returns an empty data set.
If I use the same DELETE FROM ... syntax from the command-line console, however, the whole record goes away immediately as I would expect.
Does anyone understand what's going on here?
Thanks!
Margaret
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]