nuros Posted August 25, 2008 Share Posted August 25, 2008 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 More sharing options...
nuros Posted August 25, 2008 Author Share Posted August 25, 2008 This should help paint a better picture of what I'm looking to do. Link to comment https://forums.phpfreaks.com/topic/121264-multiple-table-query/#findComment-625191 Share on other sites More sharing options...
fenway Posted August 25, 2008 Share Posted August 25, 2008 You need to push your $row variable onto another array with larger scope. Link to comment https://forums.phpfreaks.com/topic/121264-multiple-table-query/#findComment-625308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.