On Friday 08 February 2002 16:26, phantom wrote: > 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. > > 01: /* QUERY DB AND LOAD IMAGE DATA */ > 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 > image/jpeg; > 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}'";
Where is this query being used? You're not inadvertently using it twice? Could you post the complete code? > 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??? I don't see how it can "resubmit" your script again, it's not using Location:. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* The future isn't what it used to be. (It never was.) */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php