hi all,

can anyone please help me out, i am trying to display some items from my database (image items), i want to display them on a page by displaying three items at a time (e.g the first three items would display on the first row, and the next three items should display on the second row and so on till all the data in the database have been displayed). kind of like the way products are displayed in a shopping cart (three or four per row).

thanks

try this piece of code:

echo "<table border=1>"; 
$i=1;echo "<tr>";
while($row=mysql_fetch_array($result2))
{
	$image=$row['fname'];
	echo "<td>$image</td>";
	if($i%3==0)
	echo "</tr><tr>";
	$i++;
}
echo "</tr>";
echo "<table>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.