多表查询的function 错误Call to a member function fetch_all_array() on a non-object 5
publicfunctiongetList($con=NULL,$order=NULL){$sql="SELECTa.id,a.mobile,a.pwd,a.smscod...
public function getList($con=NULL,$order=NULL){
$sql = "SELECT a.id,a.mobile,a.pwd,a.smscode,a.openid,a.nickname,a.imagurl,a.registertime,a.customid,a.state,
b.id,b.`name`,b.source,b.mobile,b.telphone,b.email,b.invitcode,b.deptid,b.empid,b.addtime,
b.upddeptid,b.updempid,b.updatetime
FROM bn_accountcus a,bn_custom b WHERE a.id = b.id";
if(isset($con))
$sql .= " WHERE ". $con;
if(isset($order))
$sql .= " ORDER BY ". $order;
return $this->mh->fetch_all_array($sql);
}
}
$bn_accountcus = new BNAccountcus();
$accountcusList = $bn_accountcus->getList();
$this->setRes("accountcusList",$accountcusList); 展开
$sql = "SELECT a.id,a.mobile,a.pwd,a.smscode,a.openid,a.nickname,a.imagurl,a.registertime,a.customid,a.state,
b.id,b.`name`,b.source,b.mobile,b.telphone,b.email,b.invitcode,b.deptid,b.empid,b.addtime,
b.upddeptid,b.updempid,b.updatetime
FROM bn_accountcus a,bn_custom b WHERE a.id = b.id";
if(isset($con))
$sql .= " WHERE ". $con;
if(isset($order))
$sql .= " ORDER BY ". $order;
return $this->mh->fetch_all_array($sql);
}
}
$bn_accountcus = new BNAccountcus();
$accountcusList = $bn_accountcus->getList();
$this->setRes("accountcusList",$accountcusList); 展开
1个回答
展开全部
$sql是sql语句呀,还没有被执行,
<?php
$con = mysql_connect("localhost", "hello", "321");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("test_db",$con);
$sql = "SELECT * from Person WHERE Lastname='Adams'";
$result = mysql_query($sql,$con);
print_r(mysql_fetch_array($result));
mysql_close($con);
?>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询