What is this problem? Unknown column 'hits' in 'order clause'

Discussion in 'PHP' started by TheSyndicate, Sep 2, 2008.

  1. #1
    I get this problem all the time on my website. It keeps coming back

    Unknown column 'hits' in 'order clause'

    the website is

    www.chatthailand.com
    PHP:
    you can see the problem on the first page
     
    TheSyndicate, Sep 2, 2008 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    where's the error message there?
     
    bartolay13, Sep 2, 2008 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    ^ He posted the error message TWICE.

    And the error indicates there's no field called "hits" in your table.
     
    nico_swd, Sep 2, 2008 IP
  4. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #4
    i see it with firefox
     
    TheSyndicate, Sep 2, 2008 IP
  5. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Seems more like a SPAM than anything else. theres no errors on the site whatsoever on that front page
     
    JAY6390, Sep 2, 2008 IP
  6. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #6
    Well.. Maybe he got it fixed?
     
    elias_sorensen, Sep 2, 2008 IP
  7. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #7
    The problem come when i refresh many times and random there is a problem in

    $sqlmv = "select id, username, created, hits from members order by hits DESC limit $MVShowLimit"; 
    PHP:
    from what i understand i will try to get a screen shot

    this is the code i use

    function DisplayMostViewed($MVShowLimit){
    global $DB;
    $sqlmv = "select id, username, created, hits from members order by hits DESC limit $MVShowLimit";
    $resultmv = mysql_query($sqlmv) or die(mysql_error());
    PHP:
    function DisplayMostViewed($MVShowLimit){
    global $DB;
    $sqlmv = "select *from members order by hits DESC limit $MVShowLimit";
    $resultmv = mysql_query($sqlmv) or die(mysql_error());
    PHP:
     
    TheSyndicate, Sep 2, 2008 IP
  8. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #8
    Are you sure that 'hits' exists in your db? and I don't understand that you guys only use lower-case letters in sql queries.. That makes it way more difficult to find and fix errors.

    Do it like:
    $sqlmv = "SELECT id, username, created, hits FROM members ORDER BY hits DESC LIMIT $MVShowLimit";
     
    elias_sorensen, Sep 2, 2008 IP
  9. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #9
    Well its not its my webmaster but i will tell him. I am not sure it have hits
     
    TheSyndicate, Sep 2, 2008 IP
  10. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #10
    We found and fixed the problem and then it changed to

    Unknown column 'id' in 'field list'

    and then we fixed that and this error came

    Table 'ylb_org.files' doesn't exist

    We do not have the files on this database

    [​IMG]
     
    TheSyndicate, Sep 2, 2008 IP