I am doing a a form to add a new product to the database.when i try to run the form i am having this error.please help.I have attach my coding below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html>
<head>
<style type="text/css">
<!--
body {
	background-image: url(bgembflwrspch.jpg);
}
-->
</style></head>
<body>
<h1 align="center"><b><strong><img src="FAD_117%20copy.gif" alt="" name="main" width="170" height="59" id="main" /></strong></b></h1>
<h1 align="center"><b><i>ADD NEW PRODUCT</i> </b></h1>
<p align="center">&nbsp;</p>
<form action="">
</body>
<body>
         <form action = "insertEx2.php" method = "post" >
	productID <input type = "text" name = "ID" />
	brand <input type = "text" name = "brand" />
	type <input type = "text" name = "type" />
	size <input type = "text" name = "size" />
	price <input type = "text" name = "price" />
	manufacturedate <input type = "text" name = "manufacturedate" />
	expiry date <input type = "text" name = "expiry date " />
	manufacture of <input type = "text" name = "manufacture of" />
	<input type = "submit" name = "submit" value = "Add New Product" />
</form>
<?php
               include 'beverage.php';		         // make db connection

		       $ID = $_POST['productID'];     //store parameters in variable
               $brand = $_POST['brand'];
               $type = $_POST['type']; 
			   $size = $_POST['size'];
			   $price = $_POST['price'];
			   $manufacturedate = $_POST['manufacturedate'];
			   $expiry  = $_POST['expirydate'];
			   $manufacture= $_POST['manufactureof'];
			   			            	
			   
	
	
	$sql = "INSERT INTO product (productID, brand, type,size,price,manufacturedate,expiry date,manufactureof) values 
	('$ID','$brand','$type','$size','$price','$manufacturedate','$expiry','$manufacture','$manufacturedate','$expiry','$manufacture of')";

	mysql_query($sql) or die (mysql_error());
	mysql_close($conn);

?>

</body>
</html>

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'date,manufactureof) values ('','','','','','','','','','',' of')' at line 1- this is the error i got in the form please help to rectify my mistake

Use first this to print your query:

print_r($sql);

Add this before you run the query in your code e.g. before: mysql_query($sql) or die (mysql_error());

And post that printed query here

If you observe your query in any good editor, you will see the 'missing' factor. The last variable '$manufacture of' is causing the error. A variable name cannot have a white space. For example, $variable name is NOT a valid variable name. It should be $variablename. Thats the error.

This article has been dead for over six months. Start a new discussion instead.