mysql - sql cannot insert same customer ID into shopping cart -


im asking direction. have .sql file of tables - customer, product , shopping cart. shopping cart has customerid , productid both auto incremented , both primary keys. inserted record shopping cart specific customerid, specific productid quantity of 1. inserted record shopping cart same customer.
when trying import phpmyadmin, error: #1062 - duplicate entry '0-0' key 'primary' how add more 1 record shopping cart same customerid?

create table shopping_cart(   custid integer unsigned not null,   prodid integer unsigned not null,   quantity integer unsigned not null,   primary key(custid, prodid));  insert shopping_cart values("bostockg12345a", "dull12275226", 2); insert shopping_cart values("bostockg12345a", "jpet1224108", 1);  

thank all. change integer varchar when home. created table before assigned ids. leads me question.
shopping cart made custid , prodid though auto_increment in customer table , product table. im getting little confused comes first, chicken or egg (the auto_increments custid (and prodid) or inserts custid (or prodid). how know auto_increment id number shopping carts insert if in same file? should query id of customer name bostock , id of specific product, insert?

custid integer unsigned not null, --> integer   prodid integer unsigned not null, -->integer  insert shopping_cart values("bostockg12345a", "dull12275226", 2); insert shopping_cart values("bostockg12345a", "jpet1224108", 1);     wrong may :  inserting string data in place of integer 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -