Jump to content

Multiple table query


nuros

Recommended Posts

I'm using mysql version 5.045

 

I have two tables, "customer" (containing customer information) and "contact" (noting contact attempts for customers.)

 

I found a tutorial that gave me this query to pull data from both tables:

 

$query = "SELECT c.id, c.hisname, c.hername, c.firstcontact, c.email, c.address, c.city, c.state, c.zip, c.phone, c.realtor, u.date, u.type, u.notes FROM customer c, contact u WHERE c.id = $id AND c.id = u.id";

 

And another tutorial that puts that data into a table for output:

 

while($row = mysql_fetch_array($result))

{

 

<? echo $row['date']; ?>

<? echo $row['type']; ?>

<? echo $row['notes']; ?>

<? echo $row['hisname']; ?>

<? echo $row['address']; ?>

etc.

 

That all works great.

 

What I want to do now is output the customer information into a top section on the page, instead of listing it in the table like an array would do.  I tried assigning the variables so they can be used, and that part works, except it breaks the array.

 

Example:

 

$hisname=mysql_result($result,$i,"hisname");

 

echo $hisname;

 

So, how do I put the basic customer information at the top, and then list the contact attempts below in a table?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/121264-multiple-table-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.