By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,743 Members | 1,771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,743 IT Pros & Developers. It's quick & easy.

Tracking what has been requested

P: 5
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
Jan 17 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 4,258
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:
Jan 17 '07 #2

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

$query = "SELECT view FROM table_name WHERE id='".$_GET["id"]."'";
$result = mysql_query($query);
while(list($view) = 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"]."'";

Heres the Top 20 page script:

SELECT * FROM table_name ORDER BY view DESC LIMIT 20
hope this helped.
Grtz Bertjh
Jan 17 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.