Jump to content


Photo

Mysql auto delete row


  • Please log in to reply
5 replies to this topic

#1 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 14 August 2006 - 08:59 AM

hi everybody,
Here is my question: Is it possible to delete rows automatically (based on date)? Your ideas will be greatly appreciated, thank you.
I don't need your script, I'll try to write it myself

#2 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 14 August 2006 - 09:09 AM

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()
I am a PHP Guru, ask me questions if you want to

#3 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 14 August 2006 - 09:17 AM

sorry but, can u explain it more clear? thanks for answer.
I don't need your script, I'll try to write it myself

#4 BaconBeast321

BaconBeast321
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 14 August 2006 - 09:18 AM

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

#5 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 14 August 2006 - 09:21 AM

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
I am a PHP Guru, ask me questions if you want to

#6 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 14 August 2006 - 09:32 AM

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

Yes think I understand, Thanks a lot:)
I don't need your script, I'll try to write it myself




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users