老师我的代码都是按照你视频中的内容写得。但执行的时候出现错误,不解:--Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\test\listcate.php on line 9 Array ( )-------
---代码如下----请老师帮我看看哪里出现错误?
<?php
include('db.inc.php');
function getList($pid = 0,&$result=array(),$spac = 0)
{
$spac+=2;
$sql = "SELECT * FROM tb_cate WHERE pid = $pid";
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res))
{
$row['catename'] = str_repeat(' ',$spac).'|__'.$row['catename'];
$result[]=$row;
getList($row['id'],$result,$spac);
}
return $result;
}
$rs = getList();
print_r($rs);
?>