Mysql_query sorting problem

Discussion in 'PHP' started by Matt18, Jan 17, 2012.

  1. #1
    Hello

    I am using

    mysql_query() to get some data from the table (3000+ rows). Then I use ORDER BY function to sort descending. Then I use while($row = mysql_fetch_array($result)){... to show data.

    Sorting works for some rows but then data is randomly sorted. Is there a limit on number of rows you can sort like this?

    Thank you for your help in advance!
     
    Matt18, Jan 17, 2012 IP
  2. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #2
    no there's no limit.. your sql query might have some problems.. can you post it here?
     
    JohnnySchultz, Jan 17, 2012 IP
  3. mallorcahp

    mallorcahp Peon

    Messages:
    141
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you post some of your code??? ORDER BY is not a function but should be part of the SQL query itself so need to see what the code is doing.

    As far as I know there is no limit to the number of rows you can sort but suppose using LIMIT BY (for pagination) could have some cause but again would need to see the code.
     
    mallorcahp, Jan 17, 2012 IP
  4. Matt18

    Matt18 Guest

    Messages:
    591
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    SOLVED!

    Thank you all for trying to help!

    Problem was in field type. I've set it to float and it works now! :) Thanks again.
     
    Matt18, Jan 17, 2012 IP