使用插入查询从laravel查询构建器中删除返回标记。
$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')
由于这些反引号,我收到了此错误消息。
#1136 - 列数与第1行的值计数不匹配
如何删除这些后退标记以正确插入记录
答案 0 :(得分:0)
使用此
DB::insert('insert into table (a, b, c, d) values (?, ?, ?, ?)', ['1', '2', '3', '4']);