I'm dealing with some really old code I'm trying to get running on Laravel. The database is complicated and full of unnecessarily long stored procedures that I don't have the budget to rewrite.
For the most part, these work well, as I can access singular results like $myID = $result[0]->id
I'm hoping this is something more than a gap in my PHP knowledge...
$result = DB::select(DB::raw("Call MyOldStoredProcedure()"));
print_r($result);
This gives me:
Array ( [0] => stdClass Object ( [MIN(user_responses.sectionid)] => 2 ) )
Which I unsurprisingly can't access as
$number = $result[0]["MIN(user_responses.sectionid)"]; //or...
$number = $result[0]->...
What can I do to retrieve this singular result from this weird associative array/object? I'm about to give up and parse the array string, but I know there's a better way.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire