时间:2021-07-01 10:21:17 帮助过:14人阅读
{loop $list}
......
{if $id == $pid}.
.....
.{/if}
.....
{/loop}
{loop $list}
$id - $uid -$pid
{/loop}
$sqlstr = "select * from table";
$query = mysql_query($sqlstr) or die(mysql_error());
while($thread=mysql_fetch_assoc($query)){
$result[] = $thread;
}
foreach($result as $key=>$val){
if(isset($ret[$val['pid'])){
array_push($ret[$val['pid']], $val);
}else{
$ret[$val['pid']] = array($val);
}
}
print_r($ret);