Gruzin Posted August 14, 2006 Share Posted August 14, 2006 hi everybody,Here is my question: Is it possible to delete rows automatically (based on date)? Your ideas will be greatly appreciated, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/17481-mysql-auto-delete-row/ Share on other sites More sharing options...
Chetan Posted August 14, 2006 Share Posted August 14, 2006 Yes, you need a column in the table such as time, and when you enter data you pu time() in it.and delete it everytime after check the time() Quote Link to comment https://forums.phpfreaks.com/topic/17481-mysql-auto-delete-row/#findComment-74379 Share on other sites More sharing options...
Gruzin Posted August 14, 2006 Author Share Posted August 14, 2006 sorry but, can u explain it more clear? thanks for answer. Quote Link to comment https://forums.phpfreaks.com/topic/17481-mysql-auto-delete-row/#findComment-74380 Share on other sites More sharing options...
BaconBeast321 Posted August 14, 2006 Share Posted August 14, 2006 Hi, not quite sure what you mean by automatically....But if you have an auto_increnment column, just query ORDER BY DESC 0,1 (Chooses most recent)then delete that.....if you want to do it automatically, I guess you could have an actual date colum, then get the date from DB as a variable in phptake out the ' / ' lines so it becomes an int. then just use a if($dateofentry > "08082006") { } .... Yeah duno if that'll work just throwing ideas around.. lol theres probably an inbuilt var class for dates in php to use in those sort of scenarios.. cant help you there though sorry GL Quote Link to comment https://forums.phpfreaks.com/topic/17481-mysql-auto-delete-row/#findComment-74381 Share on other sites More sharing options...
Chetan Posted August 14, 2006 Share Posted August 14, 2006 Wat i mean to say is--Have a column named 'time'.The script which you use to write to the table should put time() in there.The script where you delete, checks the time and subtracts sum time and checks if it is greater than the time stored and deletes dose.~~RG Quote Link to comment https://forums.phpfreaks.com/topic/17481-mysql-auto-delete-row/#findComment-74384 Share on other sites More sharing options...
Gruzin Posted August 14, 2006 Author Share Posted August 14, 2006 [quote author=RockingGroudon link=topic=104170.msg415325#msg415325 date=1155547309]Wat i mean to say is--Have a column named 'time'.The script which you use to write to the table should put time() in there.The script where you delete, checks the time and subtracts sum time and checks if it is greater than the time stored and deletes dose.~~RG[/quote]Yes think I understand, Thanks a lot:) Quote Link to comment https://forums.phpfreaks.com/topic/17481-mysql-auto-delete-row/#findComment-74388 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.