【发布时间】:2015-05-23 09:04:14
【问题描述】:
$query = "从表项中选择 *";
$result = mysql_query($query);
$col = array();
while ($row = mysql_fetch_array($result)){
//they have computation here inside loop.
$amount = $value;
if($row['status']>3){ // base on the status only
if($amount>0){ //base on the computation
$count = $item;
// i need to count here the item before the grouping of duplicate item below.
if (!isset($col[$row['item']])) { // this is working for grouping the duplicate value
echo $row['item'];
echo $count; // count item
$col[$row['item']] = true;
}
}
}}
如果可能,在 while 循环中的示例输出应该是这样的。
项目一 2
项目二 3
第五项 4
【问题讨论】: