jeffman Posted June 16, 2013 Share Posted June 16, 2013 Maybe you need to verify the values of $name and $email? Are you extracting them from $_POST, maybe? Could that be a problem? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 17, 2013 Share Posted June 17, 2013 If the session ID is null then it sounds like you did not print out the query to verify it. That's why I said you should never assume anything, always verify. Link to comment Share on other sites More sharing options...
MarkT Posted June 22, 2013 Author Share Posted June 22, 2013 If the session ID is null then it sounds like you did not print out the query to verify it. That's why I said you should never assume anything, always verify. Maybe you need to verify the values of $name and $email? Are you extracting them from $_POST, maybe? Could that be a problem?What should I do now then? Link to comment Share on other sites More sharing options...
thescientist Posted June 23, 2013 Share Posted June 23, 2013 You should be trying to figure out why your $_SESSION['id'] is null. Where are you starting session? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 24, 2013 Share Posted June 24, 2013 In order to verify things you need to print them, so you can see what the values are. Print your SQL queries, print the values in the session, print everything that you're using. Print all of the data. The point is to verify all of the data so you can check if something is not what you expect it to be. Link to comment Share on other sites More sharing options...
MarkT Posted June 26, 2013 Author Share Posted June 26, 2013 My $_SESSION['id'] returns null.These are where it sets the Session variable; $id = mysql_query("SELECT * FROM `users` WHERE `name` = '{$name}' AND `email` = '{$email}'");$ida = mysql_fetch_assoc($id); $_SESSION['id'] = $ida['id2']; Link to comment Share on other sites More sharing options...
justsomeguy Posted June 26, 2013 Share Posted June 26, 2013 You should verify that the value that it gets from the database and stores in the session is correct, it might not be getting anything from the database. Or the record might have a blank value for that field. Link to comment Share on other sites More sharing options...
MarkT Posted June 26, 2013 Author Share Posted June 26, 2013 You should verify that the value that it gets from the database and stores in the session is correct, it might not be getting anything from the database. Or the record might have a blank value for that field.Am i right to use mysql_fetch_assoc, and did I use it the right way etc? Link to comment Share on other sites More sharing options...
MarkT Posted June 26, 2013 Author Share Posted June 26, 2013 I have fixed the $_SESSION['id'] now, for some reason I put the array to come back as $_SESSION['id2'] Link to comment Share on other sites More sharing options...
justsomeguy Posted June 27, 2013 Share Posted June 27, 2013 Am i right to use mysql_fetch_assoc, and did I use it the right way etc? That's the right way to use it, but you should check for errors whenever you run a query: $id = mysql_query("SELECT * FROM `users` WHERE `name` = '{$name}' AND `email` = '{$email}'") or exit(mysql_error()); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now