jagjit_82 Posted September 10, 2008 Share Posted September 10, 2008 Hi, I am working on php5.I will really appreciate if some one could help me out.My php is connected to some remote database.when i fire the query through php it updates a column(named code_stat) at the remote database.it takes 30sec approx to connect to remote database and update the database. What i want is that while my php is updating database it should prompt my screen with something like "updating databases" during these 30secs. As soon as the database column in updated it should say the database updated. Can some body plz help me out.. thanks jagjit Link to comment https://forums.phpfreaks.com/topic/123538-prompting-page-while-loading/ Share on other sites More sharing options...
vicodin Posted September 10, 2008 Share Posted September 10, 2008 I have never done it before but have it go to a page that has an iframe in it and have one frame have like a flash thing saying loading and the other frame contacting the db. It should work i dont see why it wouldnt Link to comment https://forums.phpfreaks.com/topic/123538-prompting-page-while-loading/#findComment-638082 Share on other sites More sharing options...
tibberous Posted September 10, 2008 Share Posted September 10, 2008 Create a php page that calls your other PHP script from the command line as a background process, that way it won't timeout. Set the time limit of your 30 second script to 0 (infinite). Create a table with a record called processing, set it to false in the first script. Add a line to set it to true in your second script. Then make a php page that outputs the value of the processing record. Now, either create a Flash app or some ajax that checks the processing flag by loading the check page. When the 30 second script finishes, it will change the value, the process reading script will return done, and the Ajax / Flash can then react. Keep in mind browsers (internet explorer) like to cache shit, so when you reload the page to see if the process is done, don't just load "check.php", load "check.php?nocache="+Math.random(). Link to comment https://forums.phpfreaks.com/topic/123538-prompting-page-while-loading/#findComment-638103 Share on other sites More sharing options...
jagjit_82 Posted September 10, 2008 Author Share Posted September 10, 2008 if m not wrong then the information that i have grabbed is 1.Create three scripts 2.first script will create a processing record and set it to 0.It will also call 2nd script 3.The 2nd script will set the processing record to 1. 4.then the 3rd script will display the current value of processing record. Now how should i add ajax.I mean what should ajax do.which script it should call.Can you please add little bit more description ..i mean i m newbie to php as i am a C++ developer...This is first time m trying my hands in php thanks jagjit Link to comment https://forums.phpfreaks.com/topic/123538-prompting-page-while-loading/#findComment-638554 Share on other sites More sharing options...
tibberous Posted September 11, 2008 Share Posted September 11, 2008 The ajax just keeps reading the value of the 3rd script (ie: the value of the processing record). When the ajax reads in a processing value of 1, then your done, so just say loaded or re-direct or whatever else it would make sense to do. Link to comment https://forums.phpfreaks.com/topic/123538-prompting-page-while-loading/#findComment-638880 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.