RE: [PHP-DB] mysql Insert

From: Date: Wed, 07 Nov 2001 14:27:15 +0000
Subject: RE: [PHP-DB] mysql Insert
Groups: php.db 
Request: Send a blank email to php-db+get-14093@lists.php.net to get a copy of this message
I'm going to assume that $name is text. If so, it must be enclosed in quotes: $result = mysql_db_query("MyDBTest","INSERT INTO Test VALUES(\"$name\")"); I'd suggest: $query = "INSERT INTO Test VALUES(\"$name\")"; print $query; $result = mysql_db_query("MyDBTest", $query) or die("Error: ".mysql_error()); The print statement displays your query text. Copy/Paste it into the mysql command line. It should crash and burn quite nicely. -----Original Message----- From: Brad Harriger [mailto:bradharriger@clarionhospital.org] Sent: Wednesday, November 07, 2001 8:15 AM To: php-db@lists.php.net Subject: [PHP-DB] mysql Insert When I execute the line $result = mysql_db_query("MyDBTest","INSERT INTO Test VALUES($name)"); I receive the following error Unknown column 'Jeff' in 'field list' I'm not sure why I'm getting the error. I've verified that the parameters in the mysql statement are correct. There is only one column in the table. "Jeff" (without the quotes) is the value of $name when it reaches the statement. Any help would be appreciated. Thanks in advance, Brad -- 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

« previous php.db (#14093) next »