wanaka
Date Created 10/14/01 6:13:02 AM
Message Hi,
I want to create a contact list page of all the customers with the following format.
The information will be extracted from three tables, I use left join to put all three tables together.
CREATE TABLE customer(
cust_id INT AUTO_INCREMENT,
cust_name CHAR(40) NOT NULL,
cust_address TEXT,
cust_phone CHAR(8),
cust_fax CHAR(8),
segment_id INT NOT NULL,
FOREIGN KEY (segment_id) REFERENCES segment (segment_id),
PRIMARY KEY (cust_id),
UNIQUE UC_cust_name (cust_name));
CREATE TABLE contact_category(
contact_type_id INT AUTO_INCREMENT,
category_desc CHAR(20) NOT NULL,
PRIMARY KEY (contact_type_id),
UNIQUE UC_category_desc (category_desc));
CREATE TABLE contact(
contact_id INT AUTO_INCREMENT,
contact_name CHAR(20) NOT NULL,
IC CHAR(9),
mobile CHAR(8),
office_phone CHAR(8),
office_ext CHAR(4),
home_phone CHAR(8),
cust_id INT NOT NULL,
email CHAR(25),
contact_fax CHAR(8),
contact_type_id INT NOT NULL,
availability_id INT NOT NULL,
FOREIGN KEY (availability_id) REFERENCES availability (availability_id),
FOREIGN KEY (contact_type_id) REFERENCES contact_category (contact_type_id),
FOREIGN KEY (cust_id) REFERENCES customer (cust_id),
PRIMARY KEY (contact_id));
My question is how could I display the information in the following format. I am using mysql and php4.
Company 1
primary contact
david
stephen
john
secondary contact
bill
Managment contact
Shawn
Company 2
Primary contact
etc...
Is there any similar tutorial or example somewhere? I am new to PHP