I have a query:
$stockBook = DB::select(DB::Raw(" my query"));
dump($stockBook);
My o/p:
array:1 [▼
0 => {#533 ▼
+"BOOKID": "1"
+"REMAINING": 17.0
}
]
I want to retrieve the REMAINING attribute data, but I am getting error. I tried :
$remain_ = $stockBook[1]['REMAINING'];
Undefined offset: 1
again I tried
$remain_ = $stockBook->REMAINING;
Trying to get property 'REMAINING' of non-object
How can get the value of REMAINING attribute?
Cannot use object of type stdClass as arraywhen I did$remain_ = $stockBook[0]['REMAINING'];https://stackoverflow.com/a/52312233/10288451