views counter

Discussion in 'PHP' started by Hannaspice, Jun 7, 2009.

  1. #1
    Hi guys,

    I tried to count the views of each id of articles, but there is something wrong.
    Can anybody help me count the articles, please?
    Is there other mode to count the articles?

    tables:
    id
    title
    views

    if (isset($_GET['id'])){
    
    $sql="UPDATE articles SET `views`='views+1' WHERE `id`=".id;
    
    }
    PHP:
    Have a nice day.
     
    Hannaspice, Jun 7, 2009 IP
  2. HorseGalleria

    HorseGalleria Peon

    Messages:
    91
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $sql="UPDATE articles SET `views`=views+1 WHERE `id`=".$id;
     
    HorseGalleria, Jun 7, 2009 IP
  3. vetrivel

    vetrivel Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try this one:

    $id=$_GET['id'];
    $sql="UPDATE articles SET `views`='views+1' WHERE `id`='$id';


     
    vetrivel, Jun 7, 2009 IP