Fahmi Basya napsal(a):
Hi, All,

I have problem to insert several data for one customer.

description:
the customer buy some product


example:
customer= jojo.
he buy= hat,coffee and milk

problem:
i confused for inserting data to mysql, because i just can insert only one
product to mysql, i have already use an array inside my php script for
insert all variable product but  when i push submit button  the array only
contain one product.


question:
1. How is the way to create this script ...?


i will very appreciate any suggestion,

regards,

Fahmi

table 1:
CREATE TABLE customer (
   idCustomer INT NOT NULL AUTO_INCREMENT,
   PRIMARY KEY (idCustomer)
   ) comment="table containing customer personal data"

table 2:
CREATE TABLE goods (
   idGoods INT NOT NULL AUTO_INCREMENT,
   PRIMARY KEY (idGoods)
   ) comment="table containing infos about goods"

table 3:
CREATE TABLE customer_goods (
idCustomerGoods INT NOT NULL AUTO_INCREMENT,#customer can buy the same stuff more than one time, it's up to you how you ensure uniqueness in this table
   idCustomer NOT NULL INT ,
   idGoods NOT NULL INT ,
   PRIMARY KEY (idCustomerGoods),
FOREIGN KEY (idCustomer) REFERENCES customer (idCustomer) on delete cascade/restrict/set null, FOREIGN KEY (idGoods) REFERENCES goods (idGoods) on delete cascade/restrict/set null
   ) comment="goods bought by customer"

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to