Results 1 to 3 of 3

Thread: how i can restricts the reocords entry i atable?

  1. #1
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Unhappy how i can restricts the reocords entry i atable?

    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...

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    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.
    To choose the lesser of two evils is still to choose evil. My personal site

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •