想实现这样一种效果
复制代码 代码如下:
group by fielda,fieldb,fieldc...
复制代码 代码如下:
$result = mysql_query("SELECT groups,name,goods FROM table GROUP BY groups,name ORDER BY name");
$arr = array();
$i = 0;
while($row = mysql_fetch_array($result)){
$arr[] = $row;
}
$m = $i - 1;
foreach($arr as $k=>$v){
if($v[$i]['groups'] <> $v[$m]['groups']){
echo '分割符号';
}
echo $v['name'],$v['goods'];
}
新闻热点
疑难解答