Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

swarley_HIMYM's avatar

Laravel Query Procedure

what's wrong with my query procedure

$database = DB::connection("mysql_absen")->select(DB::raw('CALL `get_attendance_total_by_location`(@p0); SET @p0='%12-10-2021%''));  

i got error like this

ErrorException
A non-numeric value encountered 
0 likes
2 replies
SilenceBringer's avatar

@swarley_himym you use single quoute for wrapping statement and value. use double quotes for one of them

$database = DB::connection("mysql_absen")->select(DB::raw('CALL `get_attendance_total_by_location`(@p0); SET @p0="%12-10-2021%"'));  
swarley_HIMYM's avatar

@SilenceBringer Illuminate\Database\QueryException SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @p0="%12-10-2021%"' at line 1 (SQL: CALL get_attendance_total_by_location(@p0); SET @p0="%12-10-2021%")

Please or to participate in this conversation.