Thread: PHP & MySQL

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    59

    PHP & MySQL

    I wrote a guestbook script using PHP and MySQL and want to load the entries from the bottom of the table to the top so the most recent posts would appear at the top of the list. I know I could do this by creating a large array and display the information by counting down, but I was hoping there was some other way; maybe a special funtion or something.

    Thank You

  2. #2
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332
    add this to your mysql query

    ORDER BY ID DESC

    ID is your generic primary key, auto_increment, not null index column

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Just change your query. I'm assuming you have a date stamp or an entry id for each one.

    Look into the ORDER BY part of the SELECT query.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. combining c php and mysql
    By Thoth in forum C Programming
    Replies: 2
    Last Post: 01-30-2009, 10:55 AM
  2. MySQL libraries
    By csonx_p in forum C++ Programming
    Replies: 6
    Last Post: 10-02-2008, 02:23 AM
  3. About C++ and MySQL or oether free database
    By xxxrugby in forum C++ Programming
    Replies: 18
    Last Post: 12-30-2005, 06:28 AM
  4. I need a free host with mysql and php. don't flame me.
    By Xterria in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 05-08-2004, 06:31 PM
  5. php mysql cprogramming posting issue
    By xddxogm3 in forum Tech Board
    Replies: 5
    Last Post: 03-22-2004, 03:32 PM