Notice: Trying to get property of non-object error Notice: Trying to get property of non-object error php php

Notice: Trying to get property of non-object error


This is because $pjs is an one-element-array of objects, so first you should access the array element, which is an object and then access its attributes.

echo $pjs[0]->player_name;

Actually dump result that you pasted tells it very clearly.


The response is an array.

var_dump($pjs[0]->{'player_name'});


@Balamanigandan your Original Post :- PHP Notice: Trying to get property of non-object error

Your are trying to access the Null Object. From AngularJS your are not passing any Objects instead you are passing the $_GET element. Try by using $_GET['uid'] instead of $objData->token