I want to send a request all in laravel by a stored procedure but it gives me an error any idea how to do it
public function store(Request $request)
{
return $data = DB::select('call InsertarUsuario(?, ?, ?, ?, ?)',$request->all());
}
throws me the following error
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 2031 (SQL: call InsertUsuario(Camilo, Pepe, [email protected], 2, ENABLE)) in file C:\laragon\www\innovar2\vendor\laravel \framework\src\Illuminate\Database\Connection.php on line 671
I send 5 items
Do this:
It would be sending us a structure like the following:
So you would have to do it like this:
$request->all()
we pass an array$request->
So it can be like this:
The indicated error (2031) indicates that some parameters have not been passed to the function.
https://dev.mysql.com/doc/refman/8.0/en/client-error-reference.html#error_cr_params_not_bound
It may be that some of the expected parameters are missing from
InsertarUsuario()
or the values of all the parameters have not been passed in?
(in this case 5). Check the function definition and what values the call is generating$request->all()
(is it an array of 5 elements?).