Skip to content
Advertisement

How To Call Procedure MySql in Laravel And Pass it to Blade.php

I got problem when i want to call procedure on MySql, this my code

 $proc = DB::statement("call ambilKesimpulanLayak ('".$user->dosen->nip."')");
    return view('dosen.data_saya',compact('proc'));

when i load data_saya.blade.php it’s showing an error like this

Invalid argument supplied for foreach() (View: 
E:SKRIPSISkripsi_AHPresourcesviewsdosendata_saya.blade.php)

but i has suplied argument foreach on my blade.php

  @foreach ($proc as $p)
   <tr>
   <td>{{$p->nama_jabatan}}</td>
   <td>
   {{$p->kesimpulan}}
   </td>
   </tr>
  @endforeach

what’s wrong with my code? , Sorry for my bad english..

Advertisement

Answer

Hi Every one this case is has been solved by doing this. Go To database.php on config after that search my SQl and Add this code below options =>

'options' => PDO::ATTR_EMULATE_PREPARES => true
     
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement