RE: [PHP-DB] Update still not working
| From: | Craig Vincent | Date: | Wed, 02 Aug 2000 19:40:56 +0000 |
| Subject: | RE: [PHP-DB] Update still not working | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1733@lists.php.net to get a copy of this message | ||
> $query = "UPDATE $table SET Monday = '$mond', Tuesday = '$tuesd' ,
> Wednesday = '$wedd' , Thursday = '$thurd' , Friday = '$frid' ,
> Saturday
> = '$satd' WHERE Number = $numb";
>
>
>
> try breaking the " " sections when inserting variable content between '
> ' quotes:
>
> $query = "Update $table SET Monday = '" .$mond. "', Tuesday =
> '"
> .$tuesd. "', .... etc
>
> PHP takes the single quote to make the $ a literal.
What??? What are you talking about? Although yes there are single quotes
within the variable string...the value the variable is assigned is embedded
in double quotes means all variables inside that string will be parsed.
(Boy did that make no sense)...
Here's what I mean:
$mond = 'foo';
$table = 'bar';
$query = "UPDATE $table SET Monday = '$mond'");
Will assign $query the value
UPDATE bar SET Monday = 'foo'
And don't tell me otherwise because I've been doing MySQL/PHP programming
for years and that's always the way I've done my queries. ;)
Sincerely,
Craig Vincent
-------------------------
Senior Programmer
Jazzmonkey Media Inc.
http://www.jazzmonkey.com
-------------------------