Tracking what has been requested

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davewright
    New Member
    • Jan 2007
    • 5

    Tracking what has been requested

    Hi I have created a php mysql web site where I am streaming videos, the user selects a video from a list then it displays on my detail page. I have around 150 videos to keep track of . I need to run a report on what videos got selcted the most in that week(top 20).
    I go and look and my server log and I can only see that my detail.php page is been displayed x times not what video got selected ( some of the videos are links frm the record companys) . How do i make my detail page log in my database what got played?

    I hope this make sence
    Thanks for ANY HELP
    Cheers
    Dave
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    I assume that the visitor count is updated (possibly by your provider) at the moment the page is visited.

    To get the data you want, you'll have to make some arrangement in the script that accepts the user's choice and/or shows the stream.

    E.g. when a user selects a video you can. at that moment in your script, insert a row into a MySQL table, with all data you want to to record, like userid, IP address, title of video, etc.

    Ronald :cool:

    Comment

    • BeRtjh
      New Member
      • Jan 2007
      • 12

      #3
      Make a extra column with the name 'views'
      whenever a video is clicked, just do a mysql_query:

      [PHP]
      $query = "SELECT view FROM table_name WHERE id='".$_GET["id"]."'";
      $result = mysql_query($qu ery);
      while(list($vie w) = mysql_fetch_row ($result)){
      //you now have the current count of views, now add one
      $count = $view + 1;
      //now insert the count into the db
      $query = "UPDATE table_name SET view='".$count. "' WHERE id='".$_GET["id"]."'";
      }
      [/PHP]

      Heres the Top 20 page script:

      [PHP]
      SELECT * FROM table_name ORDER BY view DESC LIMIT 20
      [/PHP]
      hope this helped.
      Grtz Bertjh

      Comment

      Working...