将post值保存到数组。 p>
$ data2 = 数组(
'invoice_id'=>($ id),
'order_id'=> $ this-> input-> post('order_id'),
'sensactionitems_servicetype'=> $ this- >输入 - >发布('类型'),
'invoiceitems_quantity'=> $ this->输入 - >发布('数量'),
'invoiceitems_unitprice'=> $ this-> input-> post('rate'),
'nickmentitems_notes'=> $ this-> input-> post('description')
);
$ this-> db-&gt ; insert('abc_invoiceitems',$ data2);
print_r($ data2);
code> pre>
数组结构。 p>
数组
(
[invoice_id] => 21
[order_id] => 1
[invoiceitems_servicetype] =>数组
(
[0] =>订单
[ 1] =>杂项
[2] =>订单
)
[invoiceitems_quantity] =>数组
(
[0] => 5
[1] => 64
[2] => 88
)
[发票 items_unitprice] => 数组
(
[0] => 5
[1] => 6
[2] => 8
)
[invoiceitems_notes] => 数组
(
[0] => test Data1
[1] => test Data2
[2] => test Data3
)
)
code> pre>
将数组值插入数据库表。 p>
TABLE NAME --- abc_invoiceitems
+ ----------- - + ---------- + -------------------------- + ---------- ------------- + ------------------------ + ----------- --------- +
| invoice_id | order_id | invoiceitems_servicetype | invoiceitems_quantity | invoiceitems_unitprice | invoiceitems_notes |
+ ------------ + ---------- + --------------------- ----- + ----------------------- + -------------------- ---- + -------------------- +
code> pre>
我收到以下错误并且 错误是: p>
值以数组形式返回。 p>
INSERT INTO abc_invoiceitems code>( invoice_id code>, order_id code>, invoiceitems_servicetype code>, invoiceitems_quantity code>, invoiceitems_unitprice code>, invoiceitems_notes code >)VALUES('21','1',数组,数组,数组,数组) p>
blockquote>
div>