Support the ongoing development of Laravel.io →
posted 4 years ago
Eloquent
Last updated 2 years ago.
0
moderator Solution

From the documentation: https://laravel.com/docs/7.x/database#running-queries

The select method will always return an array of results. Each result within the array will be a PHP stdClass object, allowing you to access the values of the results:

You need something like this to get the result.

DB::select('call generateCugPlanReport(:prefixName, @cugPlanReportID)', [ "prefixName" => $data["prefixName"] ]);

$cugPlanReportID = null;
$selectResult = $DB::select('SELECT @planReportID AS planReportID');

if (!empty($selectResult) && isset($selectResult[0]->planReportID)) {
    // we have a result
    $cugPlanReportID = $selectResult[0]->planReportID;
}
Last updated 4 years ago.

sheenilim08 liked this reply

1

Thanks Tobias!!

tvbeek liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.