SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mysql Table Problem.

    Okay my problem has something to do with a table i use for my forums.


    Now the table contains an "ID" column.

    Something messed up the order of the "ID" table though, causing my forums to display incorrectly.

    And example is:

    The table goes like this:

    ID Name

    1 FORUM1
    2 FORUM2
    3 FORUM3
    4 FORUM4
    5 FORUM5

    etc....


    Now for some reason recently, some forums are displayed out out of order.

    Like this:

    ID Name

    1 FORUM1
    2 FORUM2
    5 FORUM5
    3 FORUM3
    4 FORUM4



    Now i'm viewing my database tables through phpmyadmin.
    Now the way they appear on the when i view the table through phpmyadmin, is the same way they appear on the forums page for my forum.

    Is there a command, or query string i can use to reorder them back in the correct order, by the ID column??

    Thanx

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    in a relational database, the rows have no order

    when you select rows from a table, and do not sort them, they come out in any old order

    this is often the same order they went in as, but not always

    so you need to add ORDER BY ID to your query
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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