Re: SQL update help

From: Date: Sat, 21 Sep 2002 07:46:11 +0000
Subject: Re: SQL update help
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-21886@lists.php.net to get a copy of this message
When in doubt, bracket : $sql = "UPDATE $table SET pages = '{$PHP_SELF}' WHERE session = '{$holy_cow}'"; Less cute, but more readable. Ignatius ____________________________________________ ----- Original Message ----- From: "Dave Smith" <DavidSmith@byu.net> To: <php-db@lists.php.net> Sent: Saturday, September 21, 2002 2:07 AM Subject: Re: [PHP-DB] SQL update help > Jeffrey is right, but here's an easier way: > > $sql = "UPDATE $table SET pages = '$PHP_SELF' WHERE session = '$holy_cow'"; > > Be sure you use double-quotes to build the string (so that all variables get interpolated) and single-quotes within. Any non-numeric value has to be quoted for an SQL statement to work properly. > > Good luck! > > --Dave > > Jeffrey_N_Dyke@Keane.com wrote: > > >if you put quotes around the variable $PHP_SELF it should work...try this. > > > >UPDATE $table SET pages = '".$PHP_SELF."' WHERE session = $holy_cow > > > >hth > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#21886) next »