Please help me with a query

From: Date: Tue, 13 Jun 2006 14:49:24 +0000
Subject: Please help me with a query
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-237888@lists.php.net to get a copy of this message
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@como.com      4534345
2           Havana         wdq@como.com     4643765
3          Santiago        dsdf@como.com      3453453
peoples
id            named           center              correod cargod
1             Albert              1           dfsasd@como.com sfgsdfgsdfgsdfg
2              Julio                1          wdfsdf@como.com sadfsgfdsfgfdsg
3             Sussan             2          efgedfg@como.com gjfhjfhjfhjfg
4             Peter                2          fgdfdfg@como.com 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.

« previous php.general (#237888) next »