Re: Table duplication

From: Date: Sat, 12 Mar 2005 12:24:56 +0000
Subject: Re: Table duplication
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210587@lists.php.net to get a copy of this message
Marquez Design wrote:
I am trying to display information in an html table from a MySQL data base. I can do this rather easily, however, I am trying to multiply that table with as many entries there are in the database. Can someone point me in the right direction or give me an example of how I can accomplish this? I can multiply rows and columns from the db, but can not multiply the table. example: <table> <tr> <td> $entry </td> </tr> <tr> <td> $entry2 </td> </tr> </table> I would like to multiply this as many times as there is entries in the database for entry and entry2. Thank you, Steve Marqurez smarquez@marquez-design.com
Maybe you can do something with this. while($row = mysql_fetch_array($rs, MYSQL_NUM)) { if ($i % 2 == 0) $bg="#d2e1ff"; if ($i % 2 == 1) $bg="#F7F7F7"; $datum = $row[1]; echo "<tr bgcolor=$bg>"; echo "<td>&nbsp;$row[0]&nbsp;</td>"; echo "<td><b>$row[3]</b>&nbsp;&nbsp;&nbsp;&nbsp;$datum</td>"; echo "</tr>"; echo "<tr>"; echo "<td bgcolor=$bg>&nbsp;</td>"; $text = str_replace("###","<br>",$row[2]); $text = str_replace("<br>\n<br>\n<br>\n<br>","<br>\n<br>",$text); $text = str_replace("<br>\n<br>\n<br>","<br>\n<br>",$text); echo "<td bgcolor=$bg>" . $text . "</td>"; echo "</td>"; echo "</tr>"; $i+=1; } -- E-mail: luc@websitemeester.nl Internet: http://www.websitemeester.nl

« previous php.general (#210587) next »