how to count that how many visitors view the videos...!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asad_black
Forum Newbie
Posts: 20
Joined: Wed Feb 11, 2009 1:59 am

how to count that how many visitors view the videos...!

Post by asad_black »

this is my page :
http://jugnoo.tv/category_story.php
in which list of videos is exist...!

click on the thumbnail video will be started..!

now i want to display that how many viewers visit the videos like on youtube and the no. visits shows on that page when after clicking on the thumbnail...! for example i want to display the no. of visits on the following page:

http://jugnoo.tv/idpage.php?id=68

i have already database and also want to save no. of visit of individual videos in database...!

i have no idea how to do this..!

http://jugnoo.tv/idpage.php?id=68

the code of above page in which i want to display the no. of visits..!

Code: Select all

<table width="100%" cellpadding="0" cellspacing="0" class="playertable" border="0">
  <tr>
    <td bgcolor="#FF9900">  <?php
 $vid_id = $_GET['id'];
$con = mysql_connect("localhost","sample","sample");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 
mysql_select_db("sample", $con);
 
$result = mysql_query("SELECT * FROM links WHERE id =$vid_id");
 
echo "<table border='0'>
<tr valign=top>
 
 
</tr>";
 
while($row = mysql_fetch_array($result))
  {
  echo "<tr valign=top>";
 
  //echo "<td>" . $row['kw'] . "</td>";
 //echo "<td>" . $row['des'] . "</td>";
  echo "<td>" . $row['embed'] . "</td>";
   echo "<td width='20'></td>";
   echo "<td class=ddesc>" . $row['ddes'] . "</td>";
  //echo "<td valgin=top >" . $row['text'] . "</td></center>";
  echo "</tr>";
  }
echo "</table>";
 
mysql_close($con);
?></td>
  </tr>
</table>
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Re: how to count that how many visitors view the videos...!

Post by William »

Add a field to your videos table called something like... "views" and then on the video table add a query that does something like...

Code: Select all

UPDATE table SET views=views+1 WHERE id=x LIMIT 1
asad_black
Forum Newbie
Posts: 20
Joined: Wed Feb 11, 2009 1:59 am

Re: how to count that how many visitors view the videos...!

Post by asad_black »

thank u so much sir.
Post Reply