> >> I think we are almost there. This code is not producing an error,
but
> >> it is also not incrementing the database. The value stays at zero.
Any
> >> idea what could be wrong?
> >>
> >> $inc_current_ad = WrapMySQLDatabaseResults("macasap", "update ads
> > where
> >> ad_id = ".$current_ad->Value("ad_id")." set
> >> rotate=".($current_ad->Value("rotate")+1),
> > "block=0","inc_current_ad");
> >
> > Are you sure $current_ad->Value("rotate") is returning a value?
> 
> Yes it is.
> 
> > If you're just trying to increment "rotate" by one, then you can use
> > Update ... set rotate = rotate + 1 where ...
> 
> Could you give me the full SQL statement?

Wait a minute... is that your right SQL up there? If so, your update is
out of order. Wouldn't you want this:

"update ads set rotate=".($current_ad->Value("rotate")+1)." where 
ad_id = " . $current_ad->Value("ad_id")

or just

"update ads set rotate = rotate + 1 where ads_id = " .
$current->Value("ad_id")

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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

Reply via email to