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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.