我有以下数组用于使用Codeigniter的insert_batch插入数据库。
Array
(
[td_customer_lphone] => Array
(
[0] => Array
(
[cust_lphone_id] =>
[l_ph_cc] => +98
[l_ph_ac] => 777
[l_ph_no] => 77
)
[1] => Array
(
[cust_lphone_id] =>
[l_ph_cc] => +78
[l_ph_ac] => 66
[l_ph_no] => 66
)
)
插入时出现以下错误。
Error Number: 1054
Unknown column '0' in 'field list'
INSERT INTO `td_customer_lphone` (`0`, `1`) VALUES ('',''), ('+98','+78'), ('777','66'), ('77','66')
我做错了什么
感谢您的帮助..
答案 0 :(得分:1)
您的语句中的(0,1)应该是您要插入的字段名称列表 - 据我所知,您不能使用序数字段编号
更像的东西(将field1和field2替换为表中列的名称
INSERT INTO td_customer_lphone (field1, field2) VALUES ('',''), ('+98','+78'), ('777','66'), ('77','66')