insert multi rows

Hi, I use

How I can multi insert do? From post I get example array


[ 'id' => null 'email' => [ 0 => 'eter' 1 => 'ewrewr' 2 => 'werewr' ] 'tel' => 'erter' 'id_osoba' => '6' ]

I try save, return error

PDOStatement::bindValue() expects parameter 3 to be integer, string given

Failed to prepare SQL: INSERT INTO osobakontaktinwestoradress (email, tel, id_osoba) VALUES (:qp0, :qp1, :qp2)

Show you db scheme for table ‘osobakontaktinwestoradress’.

Ifyou want to add several emails to one entity there are two ways:

  1. ‘email’ column should be string (varchar) so that you can save json to it.

  2. drop ‘email’ column from ‘osobakontaktinwestoradress’. And create extra table ‘osobakontaktinwestoradress_email’:





osobakontaktinwestoradress_email

--------------------------------

id (primary key)

osobakontaktinwestoradress_id (foreign key for 'osobakontaktinwestoradress')

email




In both cases you should manualy code emails loading from post to db tables.