Jump to content

session variable check in mysql causing problems


fohanlon

Recommended Posts

Hi Guys

 

I have a mysql query that checks a table for a match for a userid and a sesion variable.  I store this when the user logs on and wipe it when they log out

 

Heres the issue.  When I then try to log in again it returns my message about already being logged in even though I would expect the mysq;l query to return 0 it always returns 1.

 

Heres the code:

 

$result = mysql_query("SELECT COUNT(*) FROM log_participants WHERE AccountID = '$accid' AND Course = '$course' AND SessionID = '" . mysql_real_escape_string(session_id()) . "'");

if(!$result) echo mysql_error();

echo "Result is " . mysql_num_rows($result);

 

Result is always 1.

 

Any ideas?

 

Thanks,

 

fergal.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.