Your query is wrong. You are selecting only one result yet you are referencing three. I suggest... SELECT * FROM centers ORDER BY idc asc Jef -----Original Message----- From: Jesús Alain Rodríguez Santos [mailto:wmaster@xxxxxxxxxxxxxxxx] Sent: Tuesday, June 13, 2006 8:49 AM To: php-general@xxxxxxxxxxxxx Subject: Please help me with a query First of all I'm sorry for my english I don't know speak very well, I will try to explain it, I hope you understain what I need. I have two tables: centers and peoples, in table centers I have the centers values and in table peoples I have the peoples values and in table columns center the id corresponding the center. db: centers id namec correoc telc 1 Cienfuegos safd@xxxxxxxx 4534345 2 Havana wdq@xxxxxxxx 4643765 3 Santiago dsdf@xxxxxxxx 3453453 peoples id named center correod cargod 1 Albert 1 dfsasd@xxxxxxxx sfgsdfgsdfgsdfg 2 Julio 1 wdfsdf@xxxxxxxx sadfsgfdsfgfdsg 3 Sussan 2 efgedfg@xxxxxxxx gjfhjfhjfhjfg 4 Peter 2 fgdfdfg@xxxxxxxx fgjhfgjgfjhjjghj And the query and script to generate the tables for each centers list is: $centers = mysql_query("SELECT namec FROM centers ORDER BY idc asc", $connect); while ($centerss = mysql_fetch_array($centers, MYSQL_ASSOC)) { echo "<table border=1>"; echo "<tr>"; echo "<td width=265 height=20 align=center valign=middle>".$centerss['namec']."</td>"; echo "<td width=265 height=20 align=center valign=middle><a href=mailto:".$centerss['correoc'].">".$centerss['correoc']."</a></td>"; echo "<td width=265 height=20 align=center valign=middle>".$centerss['telc']."</td>"; echo "</tr>"; echo "</table><p></p>"; } mysql_free_result($centers); That's generate one table with one row and three columns for each center, but, I would like to generate more rows and 3 columns in each table with the named, correod and cargod of peoples corresponding the center, I mean, print the centers values with the peoples corresponding this center, in one table each one. I hope you understaind what I need, if not polease let me know. regards Alain -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que está limpio. -- 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