sid0972 Posted January 20, 2013 Share Posted January 20, 2013 hey i have a page to edit details, and when i save the details in database the results are not reflected immediately, only when i log out and login again, the new details are shown. What could be the reason?? if it is required to post the snippet of code, please do tell. Quote Link to comment https://forums.phpfreaks.com/topic/273401-values-inserted-are-not-reflected-immediately/ Share on other sites More sharing options...
stijn0713 Posted January 20, 2013 Share Posted January 20, 2013 your information provided is not sufficient to give an answer. Quote Link to comment https://forums.phpfreaks.com/topic/273401-values-inserted-are-not-reflected-immediately/#findComment-1407124 Share on other sites More sharing options...
sid0972 Posted January 20, 2013 Author Share Posted January 20, 2013 i have created a login system using php and mysql, and it has an option to store and edit some details. when i edit and save the details, they get saved in the database, but they are not shown on the web page during that session. When i log out and log in again, then the new details are shown. i need to know why is this happening. Quote Link to comment https://forums.phpfreaks.com/topic/273401-values-inserted-are-not-reflected-immediately/#findComment-1407125 Share on other sites More sharing options...
stijn0713 Posted January 20, 2013 Share Posted January 20, 2013 (edited) probably because there is no code to show the saved details after the piece of code that saved the details... ? And the reason that they do show up when refreshing the page, is because the piece of code to show the detail is executed before the details are saved. Edited January 20, 2013 by stijn0713 Quote Link to comment https://forums.phpfreaks.com/topic/273401-values-inserted-are-not-reflected-immediately/#findComment-1407128 Share on other sites More sharing options...
sid0972 Posted January 20, 2013 Author Share Posted January 20, 2013 (edited) You are correct at one point, when details are saved i always clicked 'back', as i didnt put any 'link' there to go back. But it still does not explain that why, after coming back to the display page, details are not being displayed even after hitting refresh, as you said, but only after the current session is destroyed and new one starts. EDIT: when i log in, details are displayed correctly, no problem, but then if i click on some other link ( i have several ) and if i come back to display page, details are gone...... only show up when i log out and log in again. Does it have to do something with sessions?? Edited January 20, 2013 by sid0972 Quote Link to comment https://forums.phpfreaks.com/topic/273401-values-inserted-are-not-reflected-immediately/#findComment-1407132 Share on other sites More sharing options...
sid0972 Posted January 20, 2013 Author Share Posted January 20, 2013 OK i solved it. earlier i was passing the username in the function as an argument. Now i tried taking username from session variable, $name=$_SESSION['user']. now it works, thanks for taking a look into it. Quote Link to comment https://forums.phpfreaks.com/topic/273401-values-inserted-are-not-reflected-immediately/#findComment-1407133 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.