vendredi 2 décembre 2016

sql update sentence with sentence columns in laravel 5.3

How I can add a column in a sql parameter on laravel 5.3?

I have a table with : id,name,zipcode,nearag1. and a variable named agent

and I want a sql sentence for laravel 5.3 like this

UPDATE items set near_ag1=ABS(zipcode-$agent) traslate to laravel 5.3 Imade a sql raw sentence like this:

$Agzc1= $request2->input('Agzc1');

Item::raw("UPDATE items set near_ag1=ABS(zipcode-?)",[$Agzc1]);

this sql sentence can done without erorrs but in column near_ag1 is saving only 0 values.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire