mysql - Database relation and inserting a row -


i building cash register work place. having trouble mysql.

i have db 3 tables.

orders (where stores : list_id, order_id (fk order_line table),id (fk product id product table), qty, total).

order_line (where stores : order_id, order_date, order_time )

products (id,product_name,product_desc,price)

what want add order in database. insert order_line date , time , order_id(auto increment) insert items orders table can retrieve order_id order_line table can have same order_num each item in orders table.

so far, tried;

insert order_line  values('','04/25/2015','11.52.06'); insert orders values ('','orders_ibfk_2','orders_ibfk_1','2',30.00); 

and recieved error: cannot add or update child row: foreign key constraint fails (shoelacestore.orders, constraint orders_ibfk_1 foreign key (id) references products (id))

any appreciated. thank you

i think id column data types not integer. make integer if ok. when execute following query

insert order_line  values(0,'04/25/2015','11.52.06'); 

you value order_id. assume 344

and assume in products table have product id 98

then can use follwing query insert

insert orders values (0,344,98,'2',30.00); 

i assume ids integers