When I try adding a new product to my store using the admin system I made I get this error: Column count doesn’t match value count at row 1
I believe this is where the coding error is but I can’t find the problem.
<?php
if(isset($_POST[‘product_name’])){
$product_name = mysql_real_escape_string($
$price = mysql_real_escape_string($_POST[‘price’]);
$details = mysql_real_escape_string($
$sql = mysql_query(“SELECT id FROM sale WHERE product_name=’$product_name’ LIMIT 1”);
$productMatch = mysql_num_rows($sql);
if ($productMatch > 0) {
echo ‘ sorry you tried to place a duplicate “Product Name” into the system, <a href=”sale_list.php”>Click Here</a>’;
exit();
}
$sql = mysql_query(“INSERT INTO sale (id, product_name, price, detail)
VALUES(”,’$product_name’,’$price’,’$details’,now())”) or die (mysql_error());
$pid = mysql_insert_id();
$newname = “$pid.jpg”;
move_uploaded_file( $_FILES[‘fileField’][‘tmp_name’], “../product/$newname”);
header(“location: sale_list.php”);
exit();
}
?>