RE: [PHP] Is my syntax wrong?

From: Date: Thu, 06 Feb 2003 00:35:45 +0000
Subject: RE: [PHP] Is my syntax wrong?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134523@lists.php.net to get a copy of this message
> >> 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/

« previous php.general (#134523) next »