On Friday 08 February 2002 17:03, phantom wrote:
> <?
> header("Cache-Control: public");
> header("Cache-Control: max-age=" . $this->allowcache_expire * 60);
>
> $Link = mysql_connect("mysite.com", "db_user", "db_password")
> or die ("SL1-".mysql_errno().": ".mysql_error());
> mysql_select_db ("db_name", $Link)
> or die ("SL2-".mysql_errno().": ".mysql_error());
>
> /* update Counter Table */
> $UpdateCounter = "UPDATE Counter SET Ct=Ct+1 WHERE WHERE Img = '${Img}'";
Why have you got WHERE WHERE? Is it a typo?
> mysql_query($UpdateCounter, $Link);
>
> /* get Img data */
> $Query = "SELECT ImgType, ImgData FROM Photos WHERE Img = '${Img}'";
> $Results = mysql_query($Query, $Link)
> or die ("SL3-".mysql_errno().": ".mysql_error());
> $Num_rows = mysql_num_rows($Results);
>
> if ($Num_rows==1) {
> $ImgType = mysql_result($Results,0,ImgType);
> $ImgData = mysql_result($Results,0,ThmData);
> header("Content-Type: " . $ImgType);
> echo $ImgData;
> }
> ?>
Is this copy & paste direct from your source-code? If so, you have a problem
with your query:
$Query = "SELECT ImgType, ImgData FROM Photos WHERE Img = '${Img}'";
You're selecting "ImgType" & "ImgData". But here
$ImgData = mysql_result($Results,0,ThmData);
you're trying to get "ThmData" from the results.
But that still doesn't explain why your counter is increasing by 2 :(
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
"If the King's English was good enough for Jesus, it's good enough for me!"
-- "Ma" Ferguson, Governor of Texas (circa 1920)
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php