Re: Inserting a variable into a mysql_query() statement
| From: | Rick Emery | Date: | Wed, 16 Oct 2002 13:56:20 +0000 |
| Subject: | Re: Inserting a variable into a mysql_query() statement | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120193@lists.php.net to get a copy of this message | ||
$query = "DELETE FROM product WHERE manufacturer=\"$hidden_manuf_id\"";
mysql_query($query,$bb) or die(mysql_error());
or:
mysql_query("DELETE FROM product WHERE manufacturer=\"$hidden_manuf_id\"", $bb);
=================================
Phil Clark wrote:
>I'm trying to insert the variable $hidden_manuf_id into a mysql_query()
>statement.
>
>If i do this:
>mysql_query("DELETE FROM product WHERE manufacturer=$hidden_manuf_id",$bb)
>or die(mysql_error());
>PHP server doesn't see the variable because it is inside the string
>quotes"".
>
>If I do this:
>mysql_query("DELETE FROM product WHERE manufacturer="$hidden_manuf_id,$bb)
>or die(mysql_error());
>PHP server reports a parsing error.
>
>What is the correct syntax? ($bb is correctly defined.)