function type_son_id_finder($type_id){
$query=mysql_query(select id from `protduct_type` where `f_id` = '$type_id');
while ($row=mysql_fetch_assoc($query)) {
return $all_son = $row[id].,;
}
}
这个方法是输入一个父栏目id 就查找到有什么子栏目id
以上的方法
应该是输出
1,2,
但只能输出
1,
但如果把
return $all_son = $row[id].,;
改为:
echo $all_son = $row[id].,;
就能正常的显示出1,2,
这是为什么?
我如何解决?
我是想把这个方法最终输出成
1,2
让我在mysql中 where id in (1,2)
但现在只能输出第一个,还不能用return, 只能用echo?
求解!
------解决方案--------------------
function type_son_id_finder($type_id){
$query=mysql_query(select id from `protduct_type` where `f_id` = '$type_id');
$all_son = '';
while ($row=mysql_fetch_assoc($query)) {
$all_son .= $row[id].,;
}
return $all_son;
}
