I am using Laravel 5.2. I have a raw SQL statement that I like to execute.
Here is what I tried
DB::select( $sql );
However, this works for the first query. If I execute another query in the same run I get the following error
FatalErrorException in Connection.php line 323: Cannot access empty property
So if I execute this
DB::select( sql1 );
and then
DB::select( $sql2 );
How can I execute multiple queries in the same run time.
I will get an error. Do I need to reinitialize the DB class before I call the second query? if so how would I reset it?
UPDATED
dd( $sql );
I get the following
" SELECT TOP 1 '1' FROM survey_answer_defined INNER JOIN survey_answer_groups ON survey_answer_groups.id = survey_answer_defined.group_id WHERE survey_answer_groups.interview_id = '243' AND survey_answer_groups.control_id IN(300) AND 'E' IN('A','B','D','E')"
If I try the following instead
DB::select(DB::unprepared($sql))
I get the following error
SQLSTATE[HY090]: [Microsoft][ODBC Driver Manager] Invalid string or buffer length (SQL: )