I am using the following code to place results in 2 columns....based on even and odd. I now need to place results in 4 columns.
How can I modify the code to display results in 4 instead of 2 columns?
Thank you
$query="SELECT mastertable.Id, mastertable.remark1,mastertable.town,mastertable.type,mastertable.photo_file,mastertable.list_price, featuredlistings20.agents_comments, featuredlistings20.Id FROM mastertable,featuredlistings20 where mastertable.Id = featuredlistings20.Id and featuredlistings20.posting_office='$client_name' ";
$result = mysql_query($query) or die("Query failed: ". mysql_error());
$i=0;
echo "<table width='0' align='center' cellspacing='2' cellpadding='2'>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$format_price = number_format($line[list_price]);
$fixremark = $line[remark1];
$fixremark = ucfirst($fixremark);
$fixremark = strtolower($fixremark);
$fixremark = ucfirst($fixremark);
if ($i%2==0) {
// $i is even
echo " <tr>\n";
print" <td width='110'><a href='http://www.uppervalleyhomesforsale.com/displayprop.php?Id=$line[Id]'><img border='3' src='http://www.bscdata.net/thumbs/propimages/$line[photo_file]'width='100' height='65'><br><font size='2'>$".$format_price."<br>".$line[town]."</font></a></div></td>";
echo " <td width='1'></td>\n";
echo " <td width='5' bgcolor='#003399' ></td>\n";
} else {
// $i is odd
print" <td width='110'><a href='http://www.uppervalleyhomesforsale.com/displayprop.php?Id=$line[Id]'><img border='3' src='http://www.bscdata.net/thumbs/propimages/$line[photo_file]'width='100' height='65'><br><font size='2'>$".$format_price."<br>".$line[town]."</font></a></div></td>";
echo " <td width='1'></td>\n";
echo " <td width='5' bgcolor='#003399'></td>\n";
echo " </tr>\n";
}
// Increment $i
$i++;
}
echo "</table>\n";
/* Free resultset */
mysql_free_result($result);