justlukeyou Posted October 14, 2012 Author Share Posted October 14, 2012 A number of time I have asked why the vardump echoes "array(3) { ["userLoggedIn"]=> int(1) ["userEmail"]=> string(23) "somewhere@yahoo.com" ["userID"]=> string(2) "id" }" how can I find the answer to that? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 14, 2012 Share Posted October 14, 2012 Answer: because that's what the array contains. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted October 14, 2012 Author Share Posted October 14, 2012 So how come the code suggested doesn't work? I also tried to echo the id nothing appears. Any suggestions why please. Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 14, 2012 Share Posted October 14, 2012 There's no $row in your latest code. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted October 14, 2012 Author Share Posted October 14, 2012 When I enter a row nothing is echoed. I also tried the email which is featured in the array. Is their else that could be wrong. I cam get the code to work when I manually enter an id, now I just need to read the id of the user. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted October 18, 2012 Author Share Posted October 18, 2012 I've been a right plonker. Instead of gathering the information from a post array I should have been gathering it from the session. Nothing else can be said than I was completely wrong. I just couldn't see the wood for the trees. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted October 18, 2012 Author Share Posted October 18, 2012 Done it, wahoo. Just needed this: $id = $_SESSION['userID']; Quote Link to comment Share on other sites More sharing options...
Andy123 Posted October 19, 2012 Share Posted October 19, 2012 (edited) Done it, wahoo. Just needed this: $id = $_SESSION['userID']; ... which is what I said in my first post within this thread: As kicken wrote, $int is nothing, which will make your SQL query invalid. What you would want to do is to use $id instead, although this variable should probably be set based on a session instead of a post value. I assume you don't want users to be able to update other users' data by changing a form value. [...] Edit: Please remember to mark this thread as solved. Edited October 19, 2012 by Andy123 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.