将PHP查询的结果分成列 [英] Spliting Results of PHP Query into Columns
本文介绍了将PHP查询的结果分成列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个小问题,使这个查询显示为四列使用PHP和HTML。我想$ vendors_query显示4列中的结果。所以不管多少行,我想要的结果显示在4列。请在下面找到代码段:
I am having a little problem getting this query to show up as four columns using PHP and HTML. I would like the $manufacturers_query to show the results in 4 columns. So irrespective of how many rows, I want the results to show up in 4 columns. Please find below the code snippet:
$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))) {
$ b b
我需要这个列在4列,但不知道我在哪里错了。我知道我的设计是错误的,但是更多的眼睛比两个更好?
I need this to be listed in 4 columns, but don't know where I'm going wrong. I know my design is wrong, but more eyes is better than two?
任何帮助吗?非常感谢!
Any help please? Thanks so much in advance!
推荐答案
每4行返回 true
:
if ( $row % 4 == 0 )
这篇关于将PHP查询的结果分成列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文