时间:2021-07-01 10:21:17 帮助过:22人阅读
include("includes/config.php"); //第 7,8 行报错 lei(0); $ii=0; function lei($belongs_id){ // 解决方法1, 不填$conn $sql=mysql_query("select * from pro_type where belongs_id='".$belongs_id."'"); // 解决方法2, 以参数传递,或声明为全局 // global $conn; // $sql=mysql_query("select * from pro_type where belongs_id='".$belongs_id."'", $conn); while($rs_info=mysql_fetch_array($sql)){ //大类 if($belongs_id==0){ echo "大类"; }else{ echo "小类"; } $ii=$ii+1; lei($rs_info["id"]); $ii=$ii-1; } } ?>
------解决方案--------------------
难道要
global $conn ;
$sql=mysql_query("select * from pro_type where belongs_id='".$belongs_id."'",$conn);