[this is sql table] 1SELECT id,account_name,parent_id FROM (SELECT id,account_name,parent_id, CASE WHEN id = 1 THEN @idlist := CONCAT(id) WHEN FIND_IN_SET(parent_id,@idlist) THEN @idlist := CONCAT(@idlist,',',id) END as checkId FROM chart_of_account ORDER BY id ASC) as T WHERE checkId IS NOT NULL
When i run this query in mysql i work fine result fetch perfect
but i run it in laravel like this
$accountId = DB::select('SELECT id,account_name,parent_id FROM (SELECT id,account_name,parent_id, CASE WHEN id = '.$account_id.' THEN @idlist := CONCAT(id) WHEN FIND_IN_SET(parent_id,@idlist) THEN @idlist := CONCAT(@idlist,',',id) END as checkId FROM chart_of_account ORDER BY id ASC) as T WHERE checkId IS NOT NULL');
give error
Argument 1 passed to Illuminate\Database\Connection::prepareBindings() must be of the type array, string given, plz help thanx in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire