table('de">
时间:2021-07-01 10:21:17 帮助过:18人阅读
function get_number_list($cat_id)
{
$sql=$GLOBALS['db']->query("select * from ".$GLOBALS['db']->table('dept_category')." order by sort");
while($row=$GLOBALS['db']->fetch_array($sql)){
if($row){
$result=$GLOBALS['db']->query("select * from ".$GLOBALS['db']->table('number')." where dept=".$row['cat_id']." and cat_id='$cat_id' order by sort");
while($rows=$GLOBALS['db']->fetch_array($result)){
if($rows){
$number_show[] = array(
'id' => $rows['id'],
'title' => $rows['title'],
'user' => $rows['username']
);
}
}
$cat_name[]=array(
'sort' => $row['sort'],
'cat_name' => $row['cat_name'],
'topid' => $number_show
);
}
}
return $cat_name;
}
{$dept.cat_name} | |
{$number.user} | {$number.title} |
function get_number_list($cat_id)利用unset对数组进行清空。
{
$sql=$GLOBALS['db']->query("select * from ".$GLOBALS['db']->table('dept_category')." order by sort");
while($row=$GLOBALS['db']->fetch_array($sql)){
if($row){
$result=$GLOBALS['db']->query("select * from ".$GLOBALS['db']->table('number')." where dept=".$row['cat_id']." and cat_id='$cat_id' order by sort");
while($rows=$GLOBALS['db']->fetch_array($result)){
if($rows){
$number_show[] = array(
'id' => $rows['id'],
'title' => $rows['title'],
'user' => $rows['username']
);
}
}
$cat_name[]=array(
'sort' => $row['sort'],
'cat_name' => $row['cat_name'],
'topid' => $number_show
);
unset($number_show);
}
}
return $cat_name;
unset($cat_name);
}