Jump to content

Archived

This topic is now archived and is closed to further replies.

Chesso

Download Hit Counter, how to update database on click of url?

Recommended Posts

I've been building up a new version of my personal site (building and testing it locally) and I would like to implement a stat showing of how many times a particular file has been downloaded. I already have the database and fetching code done it's just the updating part i'm stuck on.

On my files page up to 5/10 entrys are shown and they are directly linked, I don't have that annoying redirect to 50 other pages thing going on.... So I need to somehow update the download value to increase when they click on a download link.

Any ideas?

P.S. Sorry if this has been answered but because of my idiotic (and quite literally spastic brother) my speed has been capped to dial-up as well as he has the balls to still be playing WoW so searching all through the forum would take a long time.

Share this post


Link to post
Share on other sites
Guest footballkid4
Try this:
[code]<?php
//connect to mySQL
mysql_query( "UPDATE downloads SET downloads=downloads+1 WHERE id='" . $_GET['id'] . "'" );
?>[/code]
Then you can use that page to redirect to your download, or even download directly from that page

Share this post


Link to post
Share on other sites
Iv'e come across another problem, I can't seem to Update/Replace a record in my table.

Performing the query in phpMyAdmin works perfectly fine, however in my php script it does not.

The code executes and nothing happens, no errors, no warning and other query like reading information work just fine......

Any ideas?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.