Sessions and MySQL
Posted on 2002-03-08
I'm making an online app where the my client wants to save a bunch of data into a database including the actual session id then later they'll use this information for something else they're doing.
In any case, I have one part in my program that I can't seem to figure out why. Here's a snippet
$sessionid = session_id();
$queryresult = mysql_query("SELECT * FROM energybook WHERE session='$sessionid'");
$booknumrows = mysql_num_rows($queryresult);
if($booknumrows == 0)
print "HEY!, I found a one!. Let's update the existing record";
Print "Let's insert the record now";
The problem here is, I know I have an existing record in my table but the thing is not finding it. Ok, I know that if I close my browser and reopen, i'll get another session but all this occurs within the SAME session so I don't believe that's the problem.