From my main script, I created a new CGI::Session object to start a new session and used MySQL for persistent data storage. It worked.
I keep on pushing data to the session for use later on. When the user logs-in, I store the user credentials to the session. However, I have a need to identify a session with the user so I added a column in the "sessions" table named user_id (INT(10) UNSIGNED NOT NULL).
After the user log-on credentials were verified and authenticated, it's time for me to update the sessions table to add the user_id and associate it with a session. Here's the simple code:
$sth = $dbh->do ("UPDATE sessions SET user_id='$user_id' WHERE id LIKE '$CGISESSID'");The problem here is that when I viewed the session table, the user_id column has not been updated. I verified the variables: $user_id and $CGISESSID indeed have real values. I just can't understand why it never got updated... is there something wrong with the above SQL code? To experiment further, I tried this (instead of the above code):
$sth = $dbh->do ("DELETE FROM sessions");To my amazement, the session that was created was still there, while the old ones were deleted. Isn't it supposed to be delete also?
I have an impression that this is a simple problem, but it got tricky that I proved myself wrong. Any ideas are welcomed.
Thanks, Jay Soon| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |