Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display 4 per lines in a table!

Status
Not open for further replies.

McKaulick

Programmer
Oct 24, 2002
35
0
0
AR
I want to display datas from a database in an html table. I have many records but I want to display them 4 by line, how can I achieve that? Here's the code that I have now that works but he display all of them on the same line.

Thanks for helping :eek:)

<table>
<tr>
<?
$requeteProducts = mysql_query("SELECT * FROM products");
while ($Products = mysql_fetch_array($requeteProducts))
{
print "<td align='middle'><table>";
print "<tr>";

print "<td class='products'>".$Products['Products_Name']."</td>";

print "</tr>";
print "<tr>";

print "<td><img src='products/".$Products['Products_Img']."'></td>";

print "</tr>";
print "</table></td>";
}
?>
</tr>
</table>
 
Why are you building so many tables within that while loop?

- - picklefish - -
Why is everyone in this forum responding to me as picklefish?
 
Ok cool, everythings fine! Thanks for the idea ascikey.

And jimoblak, the fist table tag in the code contains a cellpadding of 25! So that's why I need so much table for each images and labels!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top