Jump to content

Archived

This topic is now archived and is closed to further replies.

Gruzin

Mysql auto delete row

Recommended Posts

hi everybody,
Here is my question: Is it possible to delete rows automatically (based on date)? Your ideas will be greatly appreciated, thank you.

Share this post


Link to post
Share on other sites
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()

Share this post


Link to post
Share on other sites
sorry but, can u explain it more clear? thanks for answer.

Share this post


Link to post
Share on other sites
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 php
take 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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[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:)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.