I am working on an online directory for a state organization. Members are companies which have contact individuals, and some have branch locations. I am working on this in steps, so that my questions can be specific. My database has a "company" table with company name, address, etc., and a "contact" table with names, titles and email addresses of the individuals. I have been working with a LEFT JOIN query that selects all companies in a particular county from the "company" table, and then finds matching contacts using the company_id field, which produces the intended results - I get a row for each company with the contact person appended, and where there are more than one contact at a company, each row has duplicate company info.
My first question is: as I am looping through my results to list (echo) using this: "while($row = mysql_fetch_array( $result ))" I cannot figure out how to list the company information once, but then list only each contact person's info from the rest of the rows for the same company. If anyone can explain how to do this, I'm sure the same logic will work when I start the code for listing the branch locations.
Thanks!