Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    31
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Displaying only the latest 2 rows of a table

    Hi there!

    My problem:
    I can't exactly figure out how to display only the 2 newest rows of a table. I am using a mysql database and everything works as it should.
    It works fine to do the SELECT * FROM...but what if I only what the latest two rows to be displayed?

    I am working on a news column that should have an extract on the front page which is where I stop as I cannot seem to get this to work.

    Any ideas?

    best,
    Figurine

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,301
    Thanks
    4
    Thanked 204 Times in 201 Posts
    Add
    Code:
    ORDER BY `your field name here` DESC LIMIT 2
    to your SQL call.
    Dave .... HostMonster for all of your hosting needs

  • Users who have thanked djm0219 for this post:

    Figurine (07-30-2008)

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    31
    Thanks
    19
    Thanked 0 Times in 0 Posts

    thanks!!

    Yay!

    Thanks so much!
    Best,
    Figurine


  •  

    Posting Permissions

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