Re: counting and displaying a how many figure
| From: | Hugh Bothwell | Date: | Sun, 05 Aug 2001 13:07:55 +0000 |
| Subject: | Re: counting and displaying a how many figure | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11076@lists.php.net to get a copy of this message | ||
"Dave Carrera" <dave@davecarrera.com> wrote in message
news:EGENJHOKDODMKPOIBOMOIEFJCAAA.dave@davecarrera.com...
> Hi All
>
> I would like to know how to count how many downloads of a file I have on
my
> site is downloaded and display something like " file.name downloaded xxxx
> times" on my page.
>
> I have this idea using mysql db.
> table files
> ID int autoincrment,
> file_name,
> URL,
>
> I believe this would utilise something like the count() function but I
> haven't used this yet
Depends whether you want to track any additional information, like the IP of
the downloader or a timestamp; if so, you need a separate table with
per-download entries.
If all you want is a count, I would just add a field to the file table...
UPDATE TABLE files SET download_count=download_count+1 WHERE ID=$fileId.