PDA

View Full Version : how i can restricts the reocords entry i atable?



gurmeet
06-22-2010, 08:27 AM
i want to restrict entry in tables, means a user can only insert 5 records in a table, when he/ she enters 6th records automatically 1st records must be deleted and 2nd records should be 1st and so on/


shoild i need to change it in PHP or in mysql?
plz help...

james438
06-22-2010, 03:45 PM
You will need to use both php and mysql. There should be a column for the record and another for the user ID and a column for the datetime entered into the database.

When the form is submitted the php/MySQL will check to see how many records there are for that user and if the number is >=5 then update record that is the oldest.

djr33
06-22-2010, 03:50 PM
I'd suggest deleting the oldest then adding a new one, but that's just how I think of it. Update would work too: just make sure you update both the content and the time.