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
angelbear
Forum Newbie
Posts: 4 Joined: Thu Aug 22, 2002 2:41 am
Location: Philippines
Contact:
Post
by angelbear » Fri Aug 23, 2002 1:35 am
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 » Fri Aug 23, 2002 8:38 am
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.
llimllib
Moderator
Posts: 466 Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD
Post
by llimllib » Fri Aug 23, 2002 8:41 am
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 » Fri Aug 23, 2002 8:42 am
oh woops, i didnt read his question, hehe
my fault
Pocketx
Forum Commoner
Posts: 37 Joined: Fri Aug 23, 2002 9:54 pm
Post
by Pocketx » Sat Aug 24, 2002 12:41 pm
Thanks for the code! But where do you add the links to each file?
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sat Aug 24, 2002 2:18 pm
i think he was judging that you already knew a little php and would write the script with that as the concept...
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Sat Aug 24, 2002 2:30 pm
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...
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sat Aug 24, 2002 2:59 pm
Do you just try to find something to say in every topic? your name was like all the way down the page...
Xelmepa
Forum Commoner
Posts: 41 Joined: Sat Aug 24, 2002 3:02 pm
Location: Athens, Greece
Contact:
Post
by Xelmepa » Sat Aug 24, 2002 3:07 pm
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.
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Sat Aug 24, 2002 3:58 pm
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...)