照亮\ 数据库\ QueryException
SQLSTATE [42000]:语法错误或访问冲突:1064您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以获取在'[?,?]'在第1行(SQL:插入到student(name,age)值[du,22]中)
这是代码:
public function text1(){
// return 'text1';
// $ret = DB::select('select * from student');
$insers=DB::insert('insert into student(name ,age) value [? , ?]',
['du',22]);
var_dump($insers); ;
}Db::insert('insert into student(name,age) values(?, ?)', ['du', 22])中括号改成小括号试试糠
应该这么写:
$insers=DB::insert('insert into student(name ,age) values (? , ?)',
['du',22]);