hello,
i have linux server that hosts movies on LAN.i want to display top 5 movies i.e viewed.
i have link, when user click on that link the movie start playing now i want to increment the counter in database for that specific movie, with out the user attention.
if i use form tag or query string in link then the user browser will direct to that page but i dont want to direct my user to that pagr the user can start viewing movies and movie counter increment with out user attantion plz help...
top movies Hits
Moderator: General Moderators
As soon as someone visits the page, add a query that updates the database for a specific movie ID. This update will make the current number 1 higher than it was previously.
Never tested it, it should work in theory. 
Code: Select all
<?php
// set the variabls for the database access
$host = "";
$user = "";
$pass = "";
$db = "";
$table = "";
// connecting to db
$link = mysql_connect ($Host, $User, $Password);
// setting the query variable
// specify the movie id somehow, that will tell the db which movie to update
$q = "UPDATE $table SET hits=hits+1 WHERE movieid='$movieid'";
// running a query, invisible to a user
mysql_db_query ($db, $q, $link);
// now closing the connection
mysql_close ($Link)
?>