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

  2. Colin Roosendaal wrote:

    > 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


    See this page; will probably give you ideas:
    <http://www.gossamer-threads.com/forum/General_C8/Databases_and_SQL_F36/sql_query_to_select_last_5_entries_P254072/>

    --
    -bts
    -Warning: I brake for lawn deer
     
    Beauregard T. Shagnasty, Oct 30, 2005
    #2
    1. Advertising

  3. Colin Roosendaal

    JDS Guest

    On Sun, 30 Oct 2005 18:49:28 +0100, Colin Roosendaal wrote:

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


    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 | lid
    | http://www.newtnotes.com
    DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
     
    JDS, Oct 31, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ted Zeng
    Replies:
    4
    Views:
    569
    Tim Arnold
    Oct 3, 2006
  2. Ted Zeng
    Replies:
    0
    Views:
    683
    Ted Zeng
    Oct 13, 2006
  3. Rajive Narain
    Replies:
    0
    Views:
    2,080
    Rajive Narain
    Sep 18, 2009
  4. neha shena
    Replies:
    1
    Views:
    281
    Dennis Lee Bieber
    Oct 29, 2010
  5. Replies:
    3
    Views:
    236
    frothpoker
    Sep 4, 2006
Loading...

Share This Page