vendredi 4 août 2017

Parsing query into variable not working laravel

I've query like this

$sql_tampil = DB::connection('pgsql2')->select("SELECT sum(nilai) FROM laporan WHERE bulan='01' AND tahun='2011' AND (audited='0') AND");
$sql_tampil2 = DB::connection('pgsql2')->select("SELECT sum(nilai) FROM laporan WHERE bulan='03' AND tahun='2014' AND (audited='0') AND");

After AND is pass by another $variable

$sql_kas_setara = DB::connection('pgsql2')->select("$sql_tampil grupid='11'")->get();

and show it into views

return view('laporan.posisikeuangan_laporan')->with(['sql_kas_setara' => $sql_kas_setara]);

but laravel query doesnt read AND grupid='11'

this is the error

SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at end of input LINE 1: ...oran WHERE bulan='01' AND tahun='2011' AND (audited='0') AND ^ (SQL: SELECT sum(nilai) FROM laporan WHERE bulan='01' AND tahun='2011' AND (audited='0') AND)

How do I return the query after AND ?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2urfxfm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire