I'm getting a MySQLSyntaxErrorException: Unknown column 'quantity' in 'field list'
error when inserting value to my mysqldatabase. I have the column quantity in my table but it says unknown column in field list. Below is my code and I have no idea what's wrong with it. Can anyone help me? Thank you in advance.
query = "insert into tbl_reservations(cust_name,product_name,quantity,price,total,purchase_date,order_number,status) values ('" + nam + "','" + name[x] + "','" + quantity[x] + "','"+ fprice[x] + "','" + price[x] + "','" +currentDate+ "','" + rnum + "','" + status + "')";
System.out.println(query);
int i = st.executeUpdate(query);
System.out.println(query);
Adding the TABLE details to the question (taking it from the comment) for readability:
Field Type Null Key Default Extra
id int(11) NO PRI NULL auto_increment
cust_name varchar(255) YES NULL
quantity int(11) YES NULL
price double NO NULL
total double NO NULL
purchase_date date YES NULL
order_number int(255) NO NULL
status varchar(255) NO NULL
describe tbl_reservations
. – eg04lt3r