eddierosenthal Posted March 7, 2008 Share Posted March 7, 2008 i have an application that has several pages of forms and data entry is recorded in the mysql db. if the user finishes, ie; goes thru all the pages and finishes, the php hander for the form does its calculations / reports and emails and removes the data in the database. There is ajax involved, in that as the data is entered in the php handler is called for mysql data recording. If user does not finish the form, or does not go thru to the finish, what sort of solution is available for cleaning up the database? I would like to be able to call the php hander if the user closes the window ( on any of the pages) to clean up. I could add a cancel button but prefer to either prompt for finishing or cleanup. Do i have to create some sort of cron job to clean up the db, or is there a way to do it directly? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 7, 2008 Share Posted March 7, 2008 cover all bases by using a cron job. Quote Link to comment Share on other sites More sharing options...
eddierosenthal Posted March 7, 2008 Author Share Posted March 7, 2008 what about starting a new process that waits for an hour then goes and cleans up? is there a 'fork' within the php functions? Quote Link to comment Share on other sites More sharing options...
maexus Posted March 7, 2008 Share Posted March 7, 2008 A cron job is the way to go. Just set the cron job to check if that data it's clearing is older than an hour. Quote Link to comment Share on other sites More sharing options...
eddierosenthal Posted March 8, 2008 Author Share Posted March 8, 2008 that doesn't appear to me like a very logical way to approach the thing. If i clean up after an hour with a cron job and a different user is entering data i would certainly mess up their session. I think what i really need is the primary key and the process id passed to a forked or exec'ed process, which performs the operation after it is notified / figures out that the process is dead or zombied, or at least get the primary key or session id to the cron job. I know how to pass variables to a function, how do i pass arguments to a standalone php file? is there a argv[] in php? 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.