Jump to content


Photo

Query Help Needed


  • Please log in to reply
1 reply to this topic

#1 SieRobin

SieRobin
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts
  • LocationNew Jersey

Posted 15 March 2006 - 05:36 PM

I have a chat on my website, and I was wondering if there was a way to delete the last row in the table of your database once the number of messages reaches a certain amount?

Basically I just want it so, if the number of posts reaches 30, it deletes the last message in the table, so there is a constant 30 messages, instead of deleting everything.

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 15 March 2006 - 05:45 PM


An example ok del from date a start point only.


[php]
// this gets the date 2 weeks ago and formats it 
$oldDate = date("Y-m-d H:i:s", strtotime(-2 weeks));
// delete anything "younger" then that
$sql = "DELETE FROM table WHERE DATE < '$oldDate';";
[/php]

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users