downloaded counter

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
angelbear
Forum Newbie
Posts: 4
Joined: Thu Aug 22, 2002 2:41 am
Location: Philippines
Contact:

downloaded counter

Post by angelbear »

Hi,

I just wanted to ask if it is possible to have a download counter wherein the counter adds 1 whenever theres is a successful download, not when the user click on the download button?

If so, pls tell me how? thanks!

angelbear
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Post by fatalcure »

Code: Select all

<a href='download.php?fileid=$id'>Download File $id</a>
download.php

Code: Select all

$query="UPDATE table SET downloadcount=downloadcount+1 WHERE fileid=$fileid";
mysql_query($query);
then just use the header function to redirect them to the file.
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

But no, you can never distinguish them hitting the download button and them having a successful download.
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Post by fatalcure »

oh woops, i didnt read his question, hehe ;) my fault
User avatar
Pocketx
Forum Commoner
Posts: 37
Joined: Fri Aug 23, 2002 9:54 pm

Post by Pocketx »

Thanks for the code! But where do you add the links to each file?
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

i think he was judging that you already knew a little php and would write the script with that as the concept...
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

hob_goblin wrote:i think he was judging that you already knew a little php and would write the script with that as the concept...
hehe, always happens this...
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

Do you just try to find something to say in every topic? your name was like all the way down the page...
User avatar
Xelmepa
Forum Commoner
Posts: 41
Joined: Sat Aug 24, 2002 3:02 pm
Location: Athens, Greece
Contact:

Post by Xelmepa »

Pocketx, if you don't know PHP at all, you could as well download a ready script from a big script site. Just search @ google.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

hob_goblin wrote:Do you just try to find something to say in every topic? your name was like all the way down the page...
No, I'm not... I'm just commenting on people and also helping poeple (not always though...)
Post Reply