0

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')

私は何を間違っていますか

助けてくれてありがとう..

4

1 に答える 1

1

The (0, 1) in your statement is supposed to be a list of the field names that you are inserting into - you can't use ordinal field numbers as far as I am aware

something more like (replace field1 and field2 with the names ofg the columns from your table

INSERT INTO td_customer_lphone (field1, field2) VALUES ('',''), ('+98','+78'), ('777','66'), ('77','66')
于 2013-06-21T21:26:18.077 に答える