我在使用PHP和HTML将此查询显示为四列时遇到一些问题。我希望$ manufacturers_query以4列显示结果。因此无论行数多少,我都希望结果显示在4列中。请在下面找到代码段:
$row = 0;
$manufacturers_query = tep_db_query("select manufacturers_name, manufacturers_id from " . TABLE_MANUFACTURERS . " order by manufacturers_name" );
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$row++;
echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '=' . $manufacturers['manufacturers_name'], 'NONSSL') . '">'. $manufacturers['manufacturers_name'] . ' <br> ';
}
echo "</a><br><br>\n";
if ((($row / 4) == floor($row / 4))) {
我需要将它列在4列中,但不知道我哪里出错了。我知道我的设计是错的,但更多的眼睛比两个更好?
请帮忙吗?非常感谢提前!
答案 0 :(得分:3)
每4行返回true
:
if ( $row % 4 == 0 )