Re: Is my syntax wrong?

From: Date: Tue, 04 Feb 2003 15:14:27 +0000
Subject: Re: Is my syntax wrong?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134274@lists.php.net to get a copy of this message
>The following code is giving me a "parse error, unexpected T_STRING." > >$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"); > >It's supposed to increment the value ad_id in the ads table. The >current_ad action works fine and correctly retrieves the right record. >I suspect I have a problem with my quotes? Yep. If you want to break out of your string to include you're variables, then use double quotes. $string = "insert my " . $variable . " here"; not... $string = "insert my ' . $variable . ' here"; The error is being caused because of the double quote in Value("ad_id") is being seen as the end of the string. ---John Holmes...

« previous php.general (#134274) next »