View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 09:31 AM
Jerim79
 
Posts: n/a
Default INSERT INTO using PHP

I have been working on PHP script, and was working through some
problems over at the PHP group. However, I believe my problem now boils
down to a MySQL problem. The script takes PHP variables and reads them
into a MySQL database. Here is tthe relevant part of the script:

$query='INSERT INTO review_registration() VALUES($FName, $LName,
$Company, $Title, $Address, $Apt, $City, $State, $Zip, $Phone, $Fax,
$Email, $Var1l, $Var2, $Var3, $Var4, $Var5)'

The error message is:

Query failed: Unknown column '$FName' in 'field list'

The table exists, and the varibles are correct. If I put quotation
marks around each variable inside VALUES, it will actually write the
variable name into the database. $FName for instance, instead of the
data that $FName references. However, this demonstrates that the
database connection is being made, the table is being found, and data
can be written to it. I am running MySQL 4.0.1.

The thing that sticks out at me is that $FName is not a column name,
but I don't know why the system thinks that it is. I tried defining the
columns in review_registration() but I got the same error message. Any
help will be greatly appreciated.

Reply With Quote