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) "[email protected]" ["userID"]=> string(2) "id" }" how can I find the answer to that? Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1385125 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. Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1385126 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. Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1385176 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. Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1385182 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. Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1385186 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. Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1386162 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']; Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1386168 Share on other sites More sharing options...
Andy123 Posted October 19, 2012 Share Posted October 19, 2012 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. Link to comment https://forums.phpfreaks.com/topic/269163-update-only-against-unique-id-number/page/3/#findComment-1386373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.