Mysql chronologically?

Discussion in 'Programming' started by dawilster, Oct 16, 2008.

  1. #1
    it took me ages to find out how to make a viewing system where it edits the mysql view table +1 every time someone visits that link, now i wish to retrieve a list of objects based on the most amount of views

    if someone could help me it would be really helpful

    thanks
     
    dawilster, Oct 16, 2008 IP
  2. linkstraffic

    linkstraffic Well-Known Member

    Messages:
    388
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    133
    #2
    If you provide more details about the table your are using, we can figure out something..

    
    mysql_query("SELECT nbviews FROM yourtable");
    
    PHP:
    assuming that you are updating the nbviews column each time the page is displayed:
    
    mysql_query("UPDATE yourtable SET nbviews=nbviews+1");
    
    PHP:
     
    linkstraffic, Oct 16, 2008 IP
  3. linkstraffic

    linkstraffic Well-Known Member

    Messages:
    388
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    133
    #3
    mysql_query("SELECT object FROM yourtable ORDER BY nbviews");
    PHP:
     
    linkstraffic, Oct 16, 2008 IP