Problem inserting $_session variable
Posted 04 July 2006 - 02:33 AM
Where the member_id is not typed in by the user, but is inserted using the session variable.
I have tried a couple different methods:
1. Putting the session as a local variable - $id = $_session['id'];
Then in the insert query - INSERT INTO members SET " . "member_id='$id'";
2. Having the $session['id']; straight in the insert queyr - INSERT INTO members SET " . "id='$_session['id']";
But neither of these methods work.
My id column is set as an integer, and so it only shows a 0 on every row. I have also tried text and VARCHAR with the same negative result.
What can I do to make this thing work?
Posted 04 July 2006 - 02:35 AM
Posted 04 July 2006 - 02:38 AM
Posted 04 July 2006 - 02:40 AM
Please post the relevant sections of your scripts.
Posted 04 July 2006 - 02:43 AM
If you are sure that you are always using $_SESSION and that session_start(); is at the top of your page, then echo your sql statement to see what it looks like. It may be an error in the configuration of your db field, among many other things...
Make sure that you have "or die(mysql_error())" on the end of your "mysql_query" line too. If you don't have that then you won't know if there are any errors.
Posted 04 July 2006 - 02:44 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users