insert statement prob
Posted: Tue Nov 03, 2009 9:10 pm
Hi all, im using PHP and MySql. The following parts show my DB table details and the insert statements which made me confused!!!
create table cart(cart_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
product_id int,
product_name varchar(1000),
product_price float(10,2)
);
the first statement works correctly, but in the second not!!!
mysql_query("INSERT INTO cart (product_id, product_name)
VALUES (" . $row["product_id"] . "12" . ")") or die(mysql_error());
mysql_query("INSERT INTO cart (product_id, product_name)
VALUES (" . $row["product_id"] . "Milk" . ")") or die(mysql_error());
i got "Unknown column 'Milk' in 'field list'"... any idea appreciated...
create table cart(cart_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
product_id int,
product_name varchar(1000),
product_price float(10,2)
);
the first statement works correctly, but in the second not!!!
mysql_query("INSERT INTO cart (product_id, product_name)
VALUES (" . $row["product_id"] . "12" . ")") or die(mysql_error());
mysql_query("INSERT INTO cart (product_id, product_name)
VALUES (" . $row["product_id"] . "Milk" . ")") or die(mysql_error());
i got "Unknown column 'Milk' in 'field list'"... any idea appreciated...