Re: MySQL Update command syntax

From: Date: Fri, 01 Feb 2002 16:54:41 +0000
Subject: Re: MySQL Update command syntax
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16420@lists.php.net to get a copy of this message
Off of MySQL.com: UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1, [col_name2=expr2, ...] [WHERE where_definition] [LIMIT #] So a typical UPDATE command could be UPDATE email_table SET email = 'luke.crouch@preceptsolutions.com' WHERE id = '1'; For explanations of all args and options, http://www.mysql.com/doc/U/P/UPDATE.html Hope that helps... -L "Jas" <jlgerfen@hotmail.com> wrote in message news:20020201163915.42953.qmail@pb1.pair.com... > Could anyone help me out with the update command in php? I am trying to > update a unique field on a table, or overwrite the current contents of said > field. My sql statement is as follows... > $db_name = "localhost"; > $table_name = "table01"; > $connection = @mysql_connect("localhost", "user", "password") or > die ("Could > not connect to database. Please try again later."); > $db = @mysql_select_db("$db_name",$connection) or die ("Could not select > database table. Please try again later."); > $sql = " > UPDATE $table_name > (new_area) > VALUES > (\"$new_area\") > "; > $result = @mysql_query($sql, $connection) or die ("Could not execute query. > Please try again later."); > > My question is if someone could give me an example of the UPDATE command I > would appriciate it. > Jas > >

« previous php.db (#16420) next »