[PHP] Re: UPDATE mysql

2002-06-23 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 I can't get UPDATE to work properly when querying MySQL.
 
 $query = UPDATE $table SET field1='$var1' WHERE id='$id';
 
 I want to update one field of one row in a table.  Is this syntax
 correct?
 
if id is an int type, no. You only need to quote values being passed to 
[var]char or text type fields.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] Re: UPDATE mysql

2002-06-23 Thread Jason Wong

On Monday 24 June 2002 13:03, David Robley wrote:
 In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...

  I can't get UPDATE to work properly when querying MySQL.
 
  $query = UPDATE $table SET field1='$var1' WHERE id='$id';
 
  I want to update one field of one row in a table.  Is this syntax
  correct?

 if id is an int type, no. You only need to quote values being passed to
 [var]char or text type fields.

I don't know whether it is 'correct', but it works with or without quotes. For 
consistency I would use the quotes.

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

/*
It's easier to take it apart than to put it back together.
-- Washlesky
*/


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




[PHP] Re: UPDATE mysql

2002-06-22 Thread Austin Marshall

Phil Schwarzmann wrote:
 I can't get UPDATE to work properly when querying MySQL.
 
 $query = UPDATE $table SET field1='$var1' WHERE id='$id';
 
 I want to update one field of one row in a table.  Is this syntax
 correct?
 

yes


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