General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 26th, 2003, 01:52 AM
stfu stfu is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 19 stfu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old March 26th, 2003, 11:00 PM
Brian Rosner Brian Rosner is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Denver, CO
Posts: 34 Brian Rosner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Brian Rosner Send a message via AIM to Brian Rosner Send a message via Yahoo to Brian Rosner
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.

Reply With Quote
  #3  
Old March 27th, 2003, 09:44 PM
stfu stfu is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 19 stfu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > problem with link count


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway