lundi 25 septembre 2017

Why Laravel add back ticks with insert query

Removing back ticks from laravel query builder with insert query.

$lng= 'a,b,c,d';

DB::table('table')->insert([trim($lng,'`') => $strr]);

Now this query adds back ticks automatically and i can't insert a record.

Output by this query.

insert into `table` (`a,b',c,d`) values('1','2','3','4')

because of these backticks i got this error message.

#1136 - Column count doesn't match value count at row 1

How to remove these back ticks in order to insert the record properly



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

Aucun commentaire:

Enregistrer un commentaire