Re: [PHP] Inserting a variable into a mysql_query() statement

2002-10-16 Thread Marek Kilimajer

You very likely need to use $_REQUEST[hidden_manuf_id] in your first 
example, which is almost correct otherwise( for security reasons, also 
put single quotes around it)

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.)




  



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Inserting a variable into a mysql_query() statement

2002-10-16 Thread Rick Emery

$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.)




Re: [PHP] Inserting a variable into a mysql_query() statement

2002-10-15 Thread Jason Wong

On Tuesday 15 October 2002 12:54, 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());

That should work iff manufacturer is a number. Otherwise you need 
single-quotes:

  DELETE FROM product WHERE manufacturer='$hidden_manuf_id'

 PHP server doesn't see the variable because it is inside the string
 quotes.

Actually you DO need the double-quotes in order for PHP interpret 
$hidden_manuf_id as a variable.

What you really should do is split the above into two steps:

$query = DELETE FROM product WHERE manufacturer=$hidden_manuf_id;
mysql_query($query, $bb) or die(Error in $query ::  . mysql_error());


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Check me if I'm wrong, Sandy, but if I kill all the golfers...
they're gonna lock me up and throw away the key!
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Inserting a variable into a mysql_query() statement

2002-10-14 Thread Phil Clark

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.)




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Inserting a variable into a mysql_query() statement

2002-10-14 Thread Timothy Hitchens

Single around the variable

mysql_query(DELETE FROM product WHERE manufacturer='$hidden_manuf_id',$bb)


Timothy Hitchens
[EMAIL PROTECTED]


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.)
 
 
 
 

-- 
Timothy Hitchens
Technologist / Entrepreneur
e-mail: [EMAIL PROTECTED]
mobile: 0419 521 440



-
HiTCHO Group - ABN: 85 816 540 110
Web Site: http://www.hitcho.com.au/
Snail Mail: PO Box 101 Arana Hills QLD 4054
Telephone: 07 3351 0951 - Facsimile: 07 3351 0952


IMPORTANT:
This email may be the view of the individual and
not that of the organisation. The contents of
this electronic mail (including attachments) may
be privileged and commercially confidential.

Any unauthorised use of the contents is expressly
prohibited. If you have received this document in
error, please advise us by telephone immediately
and then delete the document.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php