The code is as follows:
//返回指定的$aid 的工程类别id和他的下级类别id//参数:// $aid 工程类别, int类型// $conn 数据库连接// $str,返回值,字符串类型// 返回: 字符串,类似于 "1,3,7,8,"function get_gongchengleibie($aid, &$str, $conn){ $str = ""; $query=mysql_query(" select * from gongchengleibie where pid=$aid",$conn); while($row=mysql_fetch_array($query)) { $str .= $row["id"].","; get_gongchengleibie($row["id"], $str1, $conn);
Gongchengleibie is a database table, a 3-tier tree structure, such as
I want to remove the reference parameter $str, instead of using the return value of the way, I try to fail.
How can I change it?
If it can't be changed, what causes it?
Thank you to the great God for your attention or answer.
If the information is incomplete or the problem description is unclear, sorry + request to inform, I will immediately add.
Reply content:
The code is as follows:
//返回指定的$aid 的工程类别id和他的下级类别id//参数:// $aid 工程类别, int类型// $conn 数据库连接// $str,返回值,字符串类型// 返回: 字符串,类似于 "1,3,7,8,"function get_gongchengleibie($aid, &$str, $conn){ $str = ""; $query=mysql_query(" select * from gongchengleibie where pid=$aid",$conn); while($row=mysql_fetch_array($query)) { $str .= $row["id"].","; get_gongchengleibie($row["id"], $str1, $conn);
Gongchengleibie is a database table, a 3-tier tree structure, such as
I want to remove the reference parameter $str, instead of using the return value of the way, I try to fail.
How can I change it?
If it can't be changed, what causes it?
Thank you to the great God for your attention or answer.
If the information is incomplete or the problem description is unclear, sorry + request to inform, I will immediately add.
Change to do so, many will not say.
function get_gongchengleibie($aid, $conn){ $str = ""; $query=mysql_query(" select * from gongchengleibie where pid=$aid",$conn); while($row=mysql_fetch_array($query)) { $str .= $row["id"].","; $str .= get_gongchengleibie($row["id"], $conn); }