Jump to content

Recommended Posts

Hi all,

 

I tried to search for an answer to this but the worls "limit", "table", "size" etc. come up a lot :)

 

I'm creating a shoutbox for my site. I've got a simple table where I store the shouts (contains 4 fields: ID, Name, Shout & Date. ID auto increments). I want to ensure that this table sticks to a certain size (say 25 rows). Obviously I want the least recent shouts to be deleted.

 

What's the best way to do this? A trigger; limiting the table to a set amount of rows and it'll hopefully remove the oldest rows to make room (couldn't see anything to do this in phpMyAdmin. SQL knowledge doesn't go past the basics); or simply deleting a row everytime I insert a new one past the count of 25?

Link to comment
https://forums.phpfreaks.com/topic/2724-limiting-a-table-size/
Share on other sites

Cheers.

 

That'll work as I am using a table with auto_increment ID's. Als o Isee that the new version of MySQL has triggers implemented (or so the picture on their website was showing). So when/if my host starts to use the new MySQL, I can always try a trigger later on.

Link to comment
https://forums.phpfreaks.com/topic/2724-limiting-a-table-size/#findComment-9207
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.