0

它返回通知:未定义的属性:C:\wamp\www\classes\Profile.class.php 中的 stdClass::$testing@e-mail.com

我知道解决方案很接近......但是为什么?请帮忙。

代码如下:

$this -> set('userFname', $this -> p -> get_value_by_Profile("testing@e-mail.com"));

function get_value_by_Profile($value){
         return $this->get_from_table("user",$value,"userID",1);    
    }


function get_from_table($table,$value,$column,$where){

    $this->dbo->setFetchMode(Zend_Db::FETCH_OBJ);

    $select = $this->dbo->select()
    ->from($table)
    ->where($column.' = ?', $where);
    $obj =  $this->dbo->fetchRow($select);  

    if($obj)
    return $obj->$value;    
    }
4

2 回答 2

1

尝试将 return 语句更改为:

return $obj->$column; 
于 2013-03-09T16:29:52.740 回答
0
you read you code carefully you are retuning 
$obj->testing@e-mail.com; 
but you need to return 
$obj->userID;
means return 
$obj->$column;
于 2013-03-09T16:40:52.393 回答