phpstdclassezsql

ezSQL Object(stdClass) Cannot use object of type stdClass as array


$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

Solution

  • 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);
            }