Inserting data into a database via PHP

I keep geting

Error: 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 ‘ID, Product Name, Description, Price, Location) VALUES (’’,’’,’’,’’,’’)’ at line 1

Can any one help?

The code.
[php]<?php
$con = mysql_connect(“mysql3.000webhost.com”,“a3590170_admin”,“10114wibbz”);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}

mysql_select_db(“a3590170_oms”, $con);

$sql=“INSERT INTO oms (Product ID, Product Name, Description, Price, Location)
VALUES
(’$_POST[ProductID]’,’$_POST[ProductName]’,’$_POST[Description]’,’$_POST[Price]’,’$_POST[Location]’)”;

if (!mysql_query($sql,$con))
{
die('Error: ’ . mysql_error());
}
echo “1 record added”;

mysql_close($con);
?> [/php]

[code]


Product ID:
Product Name:

Price:
Location:
[/code]

Thank you. :slight_smile:

I responded to your other thread.

Sponsor our Newsletter | Privacy Policy | Terms of Service