RE: [PHP-DB] MySQL Update command syntax
| From: | Rick Emery | Date: | Fri, 01 Feb 2002 16:50:51 +0000 |
| Subject: | RE: [PHP-DB] MySQL Update command syntax | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16419@lists.php.net to get a copy of this message | ||
Correct your example as follows:
$sql = "UPDATE $table_name SET new_area=\"$new_area\"";
-----Original Message-----
From: jas [mailto:jlgerfen@hotmail.com]
Sent: Saturday, January 26, 2002 10:49 PM
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL Update command syntax
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net