Re: mysql Insert

From: Date: Wed, 07 Nov 2001 14:31:42 +0000
Subject: Re: mysql Insert
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14097@lists.php.net to get a copy of this message
Got it. Thanks!!! Rick Emery wrote: > 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 (#14097) next »