I'm not sure what syntax would work for you with one query. You might try the mysql list. I personally make two queries. One would be a query to the foo table to get the name and the second would be a loop to iterate through each contact info entry. For each iteration you will get the array with the individual FooContactID and when you post from that looped result you can do your update if it needs to be done etc. I hope that makes sense.
$query = "select FooLName from foo where FooID=$id"; $queryr = mysql_query($query) or die("Failed Foo"); $frow = mysql_fetch_row($queryr); echo $frow[0].": <br>"; $query2 = "select FooPhone, FooEmail from foocontact where FooID=$id"; $query2r = mysql_query($query2) or die("Failed FooContact"); $n = 0; while ($fcrow = mysql_fetch_row($query2r)) { $n++; echo $n.". ".$fcrow[0]." ".$fcrow[1]."<br>"; } That's off the top of my head. I think that's how I'd do it. I would imagine you wanted separate tables so that one person could have multiple addresses. Again I might have a typo or two in there. Just to give you an idea. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -----Original Message----- From: Matthew K. Gold [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 4:26 PM To: [EMAIL PROTECTED] Subject: [PHP] frustrating problem I hope that I can explain this problem in a logical and clear way. In MySQL, I have two tables for information:: foo, which contains FooID, FooLName, FooFName and foocontact, which contains FooID, FooContactID, FooEmail, FooPhone, FooAddress1, etc. Honestly, I can't remember why I split up the names and contact info into two separate tables, but that's the way it is... In the first hundred or so entries of foocontact, FooID and FooContactID are identical (both columns are auto-increment). But because I've occasionally had problems loading data into the database, and have had to reload some entries while delete or forgetting to delete others, the numbers are now out of synch. For some entries, that doesn't seem to be a problem (I might have fixed them by hand at an earlier date, but I can't remember), but for others, it might be. That may not matter, though. What I'd like to do is call up info from both foo and foocontact using only the FooID, which is passed in the url. I can't understand, though, why the where clause in the folllowing line isn't working the way I want it to: SELECT FooLName, FooPhone, FooEmail FROM foo, foocontact WHERE foocontact.FooID=$FooID and foo.FooID=$FooID; I've also tried: WHERE foocontact.FooID=$FooID and foo.FooID=foocontact.FooID; any idea why that doesn't work? does any of this make sense? sorry if it doesn't, and thanks in advance for your help. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php