Jump to content

new row after 3 results


Woodburn2006

Recommended Posts

i am getting results from a database and i want there to be 3 results on each row, so that when 3 results have been displayed it creates a new line and displays the next 3 results there. i have tried but cannot seem to do it. this is the code that i tried with:

[code]<table width='150' border='0' cellspacing='2' cellpadding='0'><tr>
  <?
$cell_count = 0;
while ($row = mysql_fetch_array($result)) {

if ($cell_count % 2){
extract($row);
$price = "£$price";
echo  "</tr><tr>";
$cell_count++;
}else{echo  "

    <td><div align='center'><img name='' src='' width='150' height='150' alt='' style='background-color: #CCCCCC'></td>

";
$cell_count++;
}

}
?>
 
  </tr></table>[/code]

anyone know how i can solve this?
Link to comment
https://forums.phpfreaks.com/topic/16652-new-row-after-3-results/
Share on other sites

We have had this topic twice over the last 2 days.

See threads [url=http://www.phpfreaks.com/forums/index.php/topic,102715.0.html]http://www.phpfreaks.com/forums/index.php/topic,102715.0.html[/url] and [url=http://www.phpfreaks.com/forums/index.php/topic,103051.0.html]http://www.phpfreaks.com/forums/index.php/topic,103051.0.html[/url]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.