Forum Moderators: coopster
Use a counter and modulus ...
if($cnt % 3 === 0) echo "</tr><tr>";
<table>
<?php$images_per_row = 3;
$count = 0;
$content = '<tr>';$query = mysql_query("SELECT * FROM table") or die(mysql_error());
while ($row = mysql_fetch_assoc($query))
{
echo '<td></td>';if (++$count % $images_per_row === 0)
{
echo '</tr>';
if ($count!=mysql_num_rows($query))
{
echo '<tr>';
}
}}
if ($count % $images_per_row!== 0)
{
echo '</tr>';
}
?>
</table>
Try that.
dc
?>
<table bgcolor="#ffffff" width="700" border="0" cellspacing="10" cellpadding="0">
<tr>
<?
// Display the results
while ($arrayline < $matches && $arrayline < $result_limit)
{
$ipage = $output[$arrayline][0];
$score = $output[$arrayline][1];
print "<p></p>\n";
echo '<td valign="top"><b><font class="font1">P.'.$urls[$ipage].'</font></b><br><br><a href="#" onClick="Javascript:parent.nav.openPage('.$urls[$ipage].') ; parent.main.focus();return false "><img src="/cat/'.$CATALOG_NAME."/thumbnails/".$urls[$ipage].'.jpg"></a><br><br>';
print "<div class=\"result_title\">";
<table>
<?
$x=1;
while ($arrayline < $matches && $arrayline < $result_limit)
{
$ipage = $output[$arrayline][0];
$score = $output[$arrayline][1];if($x%3==1)
{
if($x>1)
{
echo '</td></tr>';
}
echo '<tr><td>';
}
else
{
echo '</td><td>';
}
echo '<font class="font1">P.'.$urls[$ipage].'</font></b><br><br><a href="#" onClick="Javascript:parent.nav.openPage('.$urls[$ipage].') ; parent.main.focus();return false "><img src="/cat/'.$CATALOG_NAME."/thumbnails/".$urls[$ipage].'.jpg"></a><br><br>';
print "<div class=\"result_title\">";
$x++;
}
?>
</table>
let me know if this helps!
Del