猿问
下载APP

php function 怎么报错了?

程序如下:
<?php
function typelinks($idd){ 
//global dsql; 

$row = 12;
$titlelen = 50;
$dsql->SetQuery("Select * from `#@__flink` where ischeck>0 and typeid='$idd' order by sortrank asc");
$dsql->Execute();
$revalue = ""; 
for($i=1;$i<=$row;$i++)
{

if($dbrow=$dsql->GetObject())
{
$wtitle = cn_substr($dbrow->webname,$titlelen);

$revalue.= "<a href='".$dbrow->url."' target='_blank'>$wtitle</a>";
if( $i % 6 == 0)
{
$revalue.="<br>" ; 
}
}
if(!$dbrow) break;
}
return $revalue;
}

?> 
函数调用:<?php echo typelinks(2) ?>
报错提示:Fatal error: Call to a member function on a non-object in 
请高手帮忙解决下是什么问题?

qq_花开花谢_0
浏览 267回答 1
1回答

慕仰8121524

问题:$dsql->SetQuery("Select * from `#@__flink` where ischeck>0 and typeid='$idd' order by sortrank asc");$dsql->Execute();实例化对象$dsql$dsql = new&nbsp;db类;
打开App,查看更多内容
随时随地看视频慕课网APP
我要回答