Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP and mysql

Options
  • 28-10-2002 4:09pm
    #1
    Closed Accounts Posts: 287 ✭✭


    Hey people,

    I got a slight problem... I got a mysql database, got a table with lots of rows in it. Each row got a ID, 1, 2,3....100 etc. Now everytime i add an entry it goes to the next ID, so 101 would be after 100. I have a feature in the sight... Latest Submissions. How do i get the ID of the latest 3 added. I was thinking of using $resultamount= mysql_num_rows($result); and then subtract 5 off the total amount....and use that as the ID, then subtract 4, 3, 2 etc to get the latest 5. But obviously this isn't a logical way to do this. There must be an easier way. Can anybody help?

    Thanks a million.

    Donal


Comments

  • Closed Accounts Posts: 287 ✭✭donaloconnor


    Sound man nahdoic.

    Cheers!


  • Registered Users Posts: 944 ✭✭✭nahdoic


    oops. I should really watch before deleting posts. anyway here it is again (slightly changed).

    SELECT * FROM MY_TABLE ORDER BY ID DESC LIMIT 0,5;


  • Closed Accounts Posts: 287 ✭✭donaloconnor


    Yeah thanks....I partly guess that ;)

    thanks


Advertisement