[PHP/Mysql] Ascending values...

Results 1 to 12 of 12
  1. #1
    something Erlend is offline
    Grand MasterRank
    Dec 2007 Join Date
    Oslo, NorwayLocation
    791Posts

    [PHP/Mysql] Ascending values...

    Hello everyone, well im creating a database of "southpark" episodes & seasons

    and i have made the sql query by ascending so episode 1 comes first then 2 etc.

    but when i get to 10 it will be like this:


    • 1
    • 10
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    Is there any way i can fix this?


  2. #2
    Venture Adventure Tyler is offline
    LegendRank
    Nov 2008 Join Date
    United KingdomLocation
    4,441Posts

    Re: [PHP/Mysql] Ascending values...

    Because 10 includes 1.
    if you added 11,12,13 it'd be like this
    1
    10
    11
    12
    2
    3
    4
    5
    6
    7
    8
    9

    Not sure how to fix.

  3. #3
    something Erlend is offline
    Grand MasterRank
    Dec 2007 Join Date
    Oslo, NorwayLocation
    791Posts

    Re: [PHP/Mysql] Ascending values...

    Ye, i know because of the 1 ;P

  4. #4
    The Omega Superfun is offline
    Grand MasterRank
    Dec 2006 Join Date
    The NetherlandsLocation
    5,221Posts

    Re: [PHP/Mysql] Ascending values...

    mysql eh?
    Code:
    select something from table order by id

  5. #5
    The Gamma..? EliteGM is offline
    Grand MasterRank
    Jul 2006 Join Date
    NandolandLocation
    4,077Posts

    Re: [PHP/Mysql] Ascending values...

    Code:
    SELECT `anything` FROM `table` ORDER BY `id` ASC

  6. #6
    something Erlend is offline
    Grand MasterRank
    Dec 2007 Join Date
    Oslo, NorwayLocation
    791Posts

    Re: [PHP/Mysql] Ascending values...

    But i don't want it to order by id, query:

    Code:
    SELECT * FROM spdb WHERE ssd ='1' ORDER BY epd ASC
    ssd: Season Number
    epd: Episode Number

  7. #7
    The Gamma..? EliteGM is offline
    Grand MasterRank
    Jul 2006 Join Date
    NandolandLocation
    4,077Posts

    Re: [PHP/Mysql] Ascending values...

    is EPD an integer value?

  8. #8
    something Erlend is offline
    Grand MasterRank
    Dec 2007 Join Date
    Oslo, NorwayLocation
    791Posts

    Re: [PHP/Mysql] Ascending values...

    Of course :)
    Posted via Mobile Device

  9. #9
    The Gamma..? EliteGM is offline
    Grand MasterRank
    Jul 2006 Join Date
    NandolandLocation
    4,077Posts

    Re: [PHP/Mysql] Ascending values...

    I'm asking if he set it as int in the DB, not as varchar or something.

  10. #10
    something Erlend is offline
    Grand MasterRank
    Dec 2007 Join Date
    Oslo, NorwayLocation
    791Posts

    Re: [PHP/Mysql] Ascending values...

    Oh, its varchar.. should i change to integer? :)

  11. #11
    The Gamma..? EliteGM is offline
    Grand MasterRank
    Jul 2006 Join Date
    NandolandLocation
    4,077Posts

    Re: [PHP/Mysql] Ascending values...

    Yes :D That'll probably help.

  12. #12
    something Erlend is offline
    Grand MasterRank
    Dec 2007 Join Date
    Oslo, NorwayLocation
    791Posts

    Re: [PHP/Mysql] Ascending values...

    Oh thanks it worked :)



Advertisement