I have this really cool script that grabs image data stored in a mysql
bin field and echo's the data into an image file.

02: /* must get values for ImgType and ThmData */
03: $Results = mysql_query($Query, $Link)
04:         or die ("SL3-".mysql_errno().": ".mysql_error());
05: $Num_rows = mysql_num_rows($Results);
06: if ($Num_rows==1) { // show image;
07:         $ImgType = mysql_result($Results,0,ImgType);
08:         $ThmData = mysql_result($Results,0,ThmData);
09:         header("Content-Type: " . $ImgType); //$ImgType shoud be
10:         echo $ThmData;
11:        }

However, I have a simple mysql database counter that counts how many
times this image is loaded.  $UpdateQuery = "UPDATE Counter SET Ct=Ct=1
WHERE Img = '${Img}'";

However everytime I run this script the counter increments by 2 (not
1).  GRRRR.

After dicing this script up, the line that is suspect is Line 09:

If I comment out this line (Line 09), the counter increments properly
(by 1).

If I comment out Line 10 and leave Line 09 in, the counter increases by
2 and the image fails to display.  Also Line 09 echos the URL of the
image.  Could this URL be resubmitting the script again, thus
incrementing the counter an extra count???

Any ideas or where I could find more info?  Thanks.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to