Re: Problem with update-command
| From: | Torsten Roehr | Date: | Thu, 22 Apr 2004 12:34:05 +0000 |
| Subject: | Re: Problem with update-command | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34036@lists.php.net to get a copy of this message | ||
"Jeffrey N Dyke" <jeffrey_n_Dyke@Keane.com> wrote in message
news:OFC83F9145.CF6BE5D5-ON85256E7E.0041F0E4@keane.com...
> >$result=mysql_db_query("usr_172_1","UPDATE artikel SET
> >Preis='\$preis\'
> WHERE ID='\$id\'");
> >//mysql_error($result);
>
> Here you're escaping the $ and then the ', have you tried....
>
> $result=mysql_db_query("usr_172_1","UPDATE artikel SET
> Preis='{$preis}'
> WHERE ID='{$id}'");
> with those escapes this is the actual query you're sending....
> "UPDATE artikel SET Preis='$preis\' WHERE ID='$id\'"
Good point, Jeff. As the id is probably an int one doesn't need quotes at
all:
"UPDATE artikel SET Preis='" . $preis . "' WHERE ID=" . $id
Regards,
Torsten
>
> HTH
> Jeff