|
Posted by Pedro Graca on 10/26/06 23:17
nathan.fulton@gmail.com wrote:
> I'm having issues with a script. When loaded, it should grab data from
> a database, add 1 to the visits counter and then display the count in
> the form of an image. The problem is this: when the script loads,
> instead of adding 1 count to the database, it ads anywhere from 2 to 4
> counts to the database. I was wondring is anyone knows whats going on
> or how to fix it. I have attached my code below.
Hmmm ... I really don't like the idea that the image itself updates
the database. I'd do the updating outside the image
Where you have, in your HTML:
<img src="image.php?url=http%3A%2F%2Fwww.google.com%2F">
I'd do this instead:
<?php log_and_count('http://www.google.com/'); ?>
<img src="image.php">
and, of course, remove the INSERT/UPDATE update stuff from the
image code, leaving only the SELECT part.
The `log_and_count()` function would do the INSERT/UPDATE stuff.
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Navigation:
[Reply to this message]
|