Fatal error: Call to a member function getValue() on a non-object in D:\wamp\www\15\common\apps\Borough.class.php on line 253找到253行如下:function getInfo($id,$field = '*',$more_info = 0,$merge=false) {
$borough = $this->db->getValue('select '.$field .' from '.$this->tName.'  where id='.$id);  // 253行
if($more_info){
$boroughInfo = $this->db->getValue('select * from '.$this->tNameInfo.' where id='.$id);
if($merge){
return array_merge((array)$borough,(array)$boroughInfo);
}else{
return array('borough'=>$borough,'boroughInfo'=>$boroughInfo);
}
}else{
return $borough;
}

解决方案 »

  1.   

    不是用一个对象去调用成员函数
    $this->db->getValue  这个有问题 改成 $this->getValue 试下
      

  2.   

    楼上的谢谢你,按照你说的改过了之后 Fatal error: Call to undefined method Borough::getValue() in D:\wamp\www\15\common\apps\Borough.class.php on line 253
      

  3.   

    在getInfo函数的开头加 global   $db;
    还是$this->db->getValue  这样呢
      

  4.   

    你给出的这块代码所在的类是否继承了db类啊,还有db中有没有那个方法啊
      

  5.   

    在 Borough.class.php 中查找
    $this->db 出现在等号左边的行帖出周边代码
      

  6.   

    在Borough.class.php 里面的2段代码!
    public function Borough( $db )
    {
    $this->db = $db;
    }public function deleteexpert( $ids )
    {
    if ( is_array( $ids ) )
    {
    $ids = implode( ",", $ids );
    $where = "id in (".$ids.")";
    }
    else
    {
    $where = "id=".intval( $ids );
    }
    return $this->db->execute( "delete from ".$this->tNameAdviser."  where ".$where );
    } public function getExpertInfo( $id )
    {
    return $this->db->getValue( "select * from ".$this->tNameAdviser." where id = ".$id );
    } public function getLastEvaluateLog( $borough_id )
    {
    return $this->db->getValue( "select * from ".$this->tNameEvaluate." where borough_id = ".$borough_id." order by add_time desc" );
    } public function saveEvaluteLog( $dataField )
    {
    $data = $this->db->getValue( "select * from ".$this->tNameEvaluate." where borough_id = ".$dataField['borough_id']." and add_time = ".$dataField['add_time'] );
    if ( $data )
    {
    $fileddata = array(
    "borough_evaluate" => $dataField['borough_evaluate'],
    "creater" => $dataField['creater']
    );
    $this->db->update( $this->tNameEvaluate, $fileddata, "id = ".$data['id'] );
    return TRUE;
    }
    $fileddata = array(
    "borough_id" => $dataField['borough_id'],
    "borough_evaluate" => $dataField['borough_evaluate'],
    "creater" => $dataField['creater'],
    "add_time" => $dataField['add_time']
    );
    $this->db->insert( $this->tNameEvaluate, $fileddata );
    return TRUE;
    }
      

  7.   

    数据库对象没有被正确的实例化修改 Borough 成这样
    public function Borough( $db )
    {
       printr(debug_backtrace());
       $this->db = $db;
    }帖出输出结果
      

  8.   


    老大如果改成你这样的 
    Fatal error: Call to undefined function printr() in D:\wamp\www\15\common\apps\Borough.class.php on line 27如果改成 print(debug_backtrace());  页面头部多出一个 Array 字样
      

  9.   

    噢,手误
    print_r(debug_backtrace());