|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
problem with link count
hi guys, i have sql table with name "x" with fields in that order:
movie_id title year genre time actors synopsis auto_url watch_url watch_url2 watch_url3 watch_url4 subtitles date_up in fields watch_url-4 have urls like http://www.somewhere.com/file.mpg with two words i want to count movies by clicking on there link example: "Top 10 Watched Movies" as usual i know counters like http://domain.com/count.php?http://yourdomain.com/file or whatever but they count my link not movies movies_id or movies name title. Any ideas? And sorry for my bad english ![]() |
|
#2
|
|||
|
|||
|
From what I gather you want to count the number of times each movie as been watched, but you want it to be counted for only the move row and not the individual movies in each movie row? Am I correct?
If so, make your link like this http://www.domain.com/count.php?movie_id=1&movie=2 Then have the script read the movie id and update the movie hits with the move number. |
|
#3
|
|||
|
|||
|
I think on your idea but i'm not really sure so let me explane once again
![]() now i have details.php when it get: Code:
if ($_GET['mid']) {
$mid = $_GET['mid'];$result = mysql_query("SELECT * FROM movies WHERE movie_id = '$mid'") or die ("Movie query failed!");
list($movie_id, $movie_title, $year_released, $movie_genre, $running_time, $starring_actors,
$movie_synopsis, $borrower_uid, $date_due_back, $movie_format, $movie_region, $reserved_uid, $imdb_url, $watch_url, $watch_url2,
$watch_url3, $watch_url4, $subtitles) = mysql_fetch_row($result);
also i have: Code:
<?php if ($watch_url2) {
echo "<a href =\"$watch_url\" > <font size=\"+1\">CD</font></a>\n\n";
echo "<a href =\"$watch_url1\" > <font size=\"+1\">CD1</font></a>\n\n";
} else {
echo "<a href =\"$watch_url\" > <font size=\"+1\">CD</font></a>\n\n";
};
?>
so that is links in the page they output is something like this: file://mydomain.com/movie.asf so i have file count.php i put it before movie link like this: Code:
echo "<a href =\"http://mydomain.com/count.php?$watch_url\" ><font size=\"+1\">CD</font></a>\n\n"; then link look like this: http://mydomain.com/count.php?file:...n.com/movie.asf when you click on this link count.php update or insert if links is new in sql but insert this: url clicks file://domain.com/movie.asf 15 if link don't exist in sql-db count.php will create new line like: url clicks file://domain.com/movie-test.asf 2 and i can only show "Top 10 Links" not movies because i don't know how to get movies_id from that link, for exactly this link or any else every movie have that in sql: Code:
movie_id title year genre time actors synopsis auto_url watch_url watch_url2 watch_url3 watch_url4 subtitles date_up i want to put one more row with name exam: clicks in each movie like this: Code:
movie_id title year genre time actors synopsis auto_url watch_url watch_url2 watch_url3 watch_url4 subtitles date_up clicks so then i can have 'Top 10 Watched Movies" sorting them by clicks. Am I clear now? ![]() o i forgot, here is code of count.php Code:
<?
require("shared.inc.php");
$db=mysql_connect("$dbhost","$dbuser","$dbpasswd");
mysql_select_db("$dbname",$db) or die ("sql: error is no error :)");
$m_id = urldecode($QUERY_STRING);
if ($QUERY_STRING) {
$result = mysql_query("SELECT * FROM clicks WHERE m_id='$m_id'",$db);
if(mysql_num_rows($result) > 0) {
mysql_free_result($result);
$result = mysql_query("SELECT UNIX_TIMESTAMP(time) FROM clicks WHERE (m_id='$m_id')",$db);
if($row = mysql_fetch_row($result)) {
if(($row[0]+3600) < time()) {
mysql_query("UPDATE clicks SET cl_t=cl_t+1 WHERE m_id='$m_id'",$db);
} else { // if the it is same
mysql_query("UPDATE clicks SET cl_t=cl_t+1 WHERE m_id='$m_id'",$db);
}
mysql_free_result($result);
} else { // new ip address
mysql_query("UPDATE clicks SET cl_t=cl_t+1 WHERE m_id='$m_id'",$db);
}
} else { // if its a new day or a new m_id
mysql_query("INSERT INTO clicks (m_id,cl_t) VALUES ('$m_id',1)",$db);
}
$m_id="Location: ".$m_id;
header($m_id);
exit;
}
?>
thanks for your time and attention in advanced. Last edited by stfu : March 27th, 2003 at 09:48 PM. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > problem with link count |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|