PHP and MySQL

Discussion in 'HTML' started by Colin Roosendaal, Oct 30, 2005.

  1. Hello,

    Can someone tell me how to do the following:

    I'm looking for the PHP/MySQL query to get the last 5 added records from my
    database/table.

    For your info

    DB name: news
    table name: messages

    I hope you can help me.

    Thanks,

    Colin Roosendaal
     
    Colin Roosendaal, Oct 30, 2005
    #1
    1. Advertisements

  2. Beauregard T. Shagnasty, Oct 30, 2005
    #2
    1. Advertisements

  3. Colin Roosendaal

    JDS Guest

    It depends on how "last five records" is defined.

    Is there a date field in the database?
    Is there a numeric, auto-incremented ID field?

    In other words, is there any field which can be used to track what field
    was most recently added?

    Is "most recently added" the ones you want? Or do you just want the bottom
    five rows after a particular ORDER BY clause has been applied?

    Also, this is *really* not an HTML question. Try alt.php or alt.php.sql
    or comp.lang.php or other closer-to-on-topic group for more help.
     
    JDS, Oct 31, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.