jeudi 13 septembre 2018

getting data from array attribute

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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2x6t28H
via IFTTT

Aucun commentaire:

Enregistrer un commentaire