get value from json php codeigniter -


i have json object like

[   [     {       "class":"com.ehealth.data.sample_data",       "collectedby":"2013-07-21",       "collecteddate":"kamal",       "orderid":2,       "sampleid":2.897033553e9     },     {       "class":"com.ehealth.data.order_data",       "doctorusername":"kamal",       "duedate":"2014-01-02",       "orderdate":"2013-12-12",       "orderid":2,       "patientid":"p0001",       "prority":1,       "status":"complete",       "testtype":"fasting blood sugar"     }   ],   [     {       "class":"com.ehealth.data.sample_data",       "collectedby":"2013-07-22",       "collecteddate":"kamal",       "orderid":3,       "sampleid":5.978956192e9     },     {       "class":"com.ehealth.data.order_data",       "doctorusername":"kamal",       "duedate":"2014-01-02",       "orderdate":"2013-12-12",       "orderid":3,       "patientid":"p0001",       "prority":2,       "status":"complete",       "testtype":"fasting blood sugar"     }   ] ] 

and decode php array

$data['query'] = json_decode($curl_response); 

i try access valuse

foreach ($query $row) {     echo $row->sampleid;            } 

but when going access the values inside can not access error

a php error encountered  severity: notice  message: trying property of non-object  

can me. dont know do

you can it:

foreach ($query $row) {    echo $row[0]->sampleid;            } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -