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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP and mysql

  • 28-10-2002 3: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, Registered Users 2 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