Please help Can't take it anymore..I am new at this in school have assignment to insert info into database.
Error: INSERT INTO products( Product ID, Product Name, Description, Cost, Markup Percent, Refrigeration Needed, Brand, Year Introduced ) VALUES ('P0026', 'teabags', '24/case', '18', '50.00%','1' ,'Discount' ,'2008')
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, Cost, Markup Percent, Refrigeration Needed, Brand' at line 1
Code as follows:
if (isset ($_POST['submit']))
{
$id=$_POST['pid'];
$name=$_POST['pname'];
$desc=$_POST['pdesc'];
$cost=intval($_POST['pcost']);
$markup=$_POST['pmarkup'];
$fridge=($_POST['pfridge']== 'true') ? true:false;
$brand=$_POST['pbrand'];
$year=$_POST['pyear'];
$sql1="INSERT INTO products( Product ID, Product Name, Description, Cost, Markup Percent, Refrigeration Needed, Brand, Year Introduced ) VALUES ('{$id}', '{$name}', '{$desc}', '{$cost}', '{$markup}','{$fridge}' ,'{$brand}' ,'{$year}')";
$db->query($sql1);
}