Jump to content

Recommended Posts

this is my page:

http://www.tutioninn.com/id_videos.php?v_id=13

 

now in this page i want to show that how many times people visit this video..!

also this value save in the database...!

 

like:

 

http://www.jugnoo.tv/idpage.php?id=29

 

i have no idea about it..!

kindly solve my problem soon:(

 

this is my code

 


$result = mysql_query("SELECT * FROM my_vid WHERE v_id =$vid_id");

echo "<table border='0' width='50%' align='center'>
<tr valign=top>


</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr valign=top>";

// echo "<td>" . $row['v_name'] . "</td>";
echo "<br>";
echo "<td align='center' style='font:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold; text-transform:uppercase;'>" . $row['v_name'] . "</td>";

  
  
  echo "</tr>";
  
  echo "<tr valign=top>";


   echo "<td align='center' style='font:Arial, Helvetica, sans-serif; font-size:14px; color:#006699'>" . $row['v_des'] . "</td>";


  echo "</tr>";
  
  
  
  echo "<tr valign=top>";


  echo "<td>" . $row['v_emb'] . "</td>";


  echo "</tr>";
  }
  
echo "</table>";

mysql_close($con);
?>


 

You should have a field something similar like below in your table:

 

CREATE TABLE videos (
    videos_times_viewed INTEGER,
);

 

When a user views a video update the table:

 

UPDATE videos SET videos_times_viewed = videos_times_viewed + 1 WHERE videos_id = $id

if (!isset($_SESSION['video_viewed']) ^ $_SESSION['video_viewed'] !== $vid_id) {
    $_SESSION['video_viewed'] = $vid_id;
    mysql_query("UPDATE my_vid SET v_hits = v_hits + 1 WHERE v_id = $vid_id");
}
$result = mysql_query("SELECT * FROM my_vid WHERE v_id =$vid_id");

echo "<table border='0' width='50%' align='center'>
<tr valign=top>


</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr valign=top>";

// echo "<td>" . $row['v_name'] . "</td>";
echo "<br>";
echo "<td align='center' style='font:Arial, Helvetica, sans-serif; font-size:14px; font-weight:bold; text-transform:uppercase;'>" . $row['v_name'] . "</td>";

  
  
  echo "</tr>";
  
  echo "<tr valign=top>";


   echo "<td align='center' style='font:Arial, Helvetica, sans-serif; font-size:14px; color:#006699'>" . $row['v_des'] . "</td>";


  echo "</tr>";
  
  
  
  echo "<tr valign=top>";


  echo "<td>" . $row['v_emb'] . "</td>";


  echo "</tr>";
  }
  
echo "</table>";

mysql_close($con);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.