RE: [PHP] Emptying mySQl database on time-based factor!!!

From: Date: Sat, 25 Nov 2000 10:26:00 +0000
Subject: RE: [PHP] Emptying mySQl database on time-based factor!!!
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-27103@lists.php.net to get a copy of this message
I think it would be better not to trigger the cleanup every time a user logs in, but to use a probability. For example, when a user logs in you generate a random number between 1 and 10, if the number is equal to 1, you trigger the cleanup (10% probability). This way there's a cleanup often enough and you save your script from perfoming the task every time. ______________________________ Cristian Donoso Monteiro Temuco - Chile ----- Original Message ----- From: Fábio Ottolini <fabio.ottolini@uol.com.br> To: <php-general@lists.php.net> Sent: Saturday, November 25, 2000 12:36 AM Subject: Re: [PHP] Emptying mySQl database on time-based factor!!! > Richard's option is the best one. You can trigger this clean up to new users > login on the system. Simply make a delete old sessions routine that is > executed every time a new user comes in. I use this a lot on my projects. It > works more than fine. :) > > Best regards, > > Fábio Ottolini > > ----- Original Message ----- > From: "Thomas Edison Jr." <thomasedisonjr@yahoo.com> > To: "Richard Lynch" <richard@zend.com> > Cc: <php-general@lists.php.net> > Sent: Saturday, November 25, 2000 3:19 AM > Subject: Re: [PHP] Emptying mySQl database on time-based factor!!! > > > > Could there be another way out of this? COudl i do it > > some other way? > > > > For each user there is a session being created. Can i > > use that for this? The database takes in a the > > SesisonID, Name & some other columns in a row. COuld i > > use somekind of Session log-out stuff to erase each > > row pertaining to that sessionID after a given period? > > > > > > Regards, > > T. Edison jr. > > > > --- Richard Lynch <richard@zend.com> wrote: > > > Not with just MySQL -- It doesn't have fancy > > > triggers and timing stuff like > > > that. > > > > > > You could write a crontab PHP script to do it. > > > > > > Add a timestamp column to each table, and simple > > > have a series of: > > > $query = "delete from blah where update + '@ 2 > > > hours' <= now() and name = > > > 'criteria'"; > > > mysql_query($query); > > > > > > You may need to read up on cron/crontab: > > > man cron > > > man 5 crontab > > > man 8 crontab (8? maybe not 8. See the "See Also" > > > in the other entries) > > > > > > ----- Original Message ----- > > > From: "Thomas Edison Jr." <thomasedisonjr@yahoo.com> > > > Newsgroups: php.general > > > Sent: Friday, November 24, 2000 4:25 AM > > > Subject: [PHP] Emptying mySQl database on time-based > > > factor!!! > > > > > > > > > > Can we set a time out for deleting entries in the > > > > mySQl databased on a certain criteria?? This may > > > sound > > > > akward maybe... but let's see this... > > > > > > > > Someone's been entering stuff into mySQL db. > > > > He goes away.. and maybe after one or tw0 hours of > > > his > > > > dissapearing act..i would like records pertaining > > > to > > > > him from the table be deleted!! Taking maybe his > > > name > > > > into 'criteria'. > > > > > > > > Help Appreciated. > > > > > > > > > > > > ===== > > > > Rahul S. Johari (Director) > > > > ****************************************** > > > > Abraxas Technologies Inc. > > > > Homepage : http://www.abraxastech.com > > > > Email : abraxastech@yahoo.com > > > > Tel : 91-4546512/4522124 > > > > ******************************************* > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Yahoo! Shopping - Thousands of Stores. Millions of > > > Products. > > > > http://shopping.yahoo.com/ > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: > > > php-general-unsubscribe@lists.php.net > > > > For additional commands, e-mail: > > > php-general-help@lists.php.net > > > > To contact the list administrators, e-mail: > > > php-list-admin@lists.php.net > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: > > > php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: > > > php-general-help@lists.php.net > > > To contact the list administrators, e-mail: > > > php-list-admin@lists.php.net > > > > > > > > > ===== > > Rahul S. Johari (Director) > > ****************************************** > > Abraxas Technologies Inc. > > Homepage : http://www.abraxastech.com > > Email : abraxastech@yahoo.com > > Tel : 91-4546512/4522124 > > ******************************************* > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Shopping - Thousands of Stores. Millions of Products. > > http://shopping.yahoo.com/ > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#27103) next »