문제

$db = new ezSQL_mysql($user,$pass,$db,$server);
$user = $db->get_row("SELECT id,last FROM users WHERE email='$email'");
var_dump($user);

The dump returns this:

object(stdClass)#11 (5) {
   ["id"]=>
   string(1) "4"
   ["last"]=>
   string(19) "2013-01-06 14:48:24"
}

However, in attempting to ask for the id of the user via the object:

$uid=$user->id;

I get this error:

Cannot use object of type stdClass as array
도움이 되었습니까?

해결책

I fixed my own problem by eding the class and pushing get_object_vars:

if ( $output == OBJECT )
        {
            $out = $this->last_result[$y]?$this->last_result[$y]:null;
            return get_object_vars($out);
        }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top