Alright? I am trying to register several records in the bd according to the number of parcels requested, but I am not able to. My code:
php:
$Conn = parent::getConn();
try {
foreach ($this->Data as $pr):
$Query = $Conn->prepare("INSERT INTO c022vdpr (dta_pedido, nro_pedido, cod_cliente, vlr_parcela, vct_parcela, nro_parcela, quitacao) VALUES (:dtaped, :nroped, :codcli, :vlrpar, :vctpar, :nropar, :quit)");
$Query->execute(array(':dtaped' => $pr['dta_pedido'], ':codcli' => $pr['cod_cliente'], ':nroped' => $pr['nro_pedido'], ':vlrpar' => $pr['vlr_parcela'], ':vctpar' => $pr['vct_parcela'], ':nropar' => $pr['nro_parcela'], ':quit' => $pr['quitacao']
));
$this->Result = true;
$this->Error = ["<b>Atualizado!</b>", ACCEPT];
endforeach;
} catch (PDOException $e) {
$this->Result = false;
$this->Error = [$e->getMessage(), ERROR];
}
error = Erro na Linha : # 168 # :: Illegal string offset
var_dump:
object(AdminProd)[2]
private 'Data' =>
array (size=7)
'dta_pedido' => string '2017-07-03' (length=10)
'nro_pedido' => int 477037
'cod_cliente' =>
array (size=3)
0 => string '5' (length=1)
1 => string '5' (length=1)
2 => string '5' (length=1)
'vlr_parcela' => float 132.5
'vct_parcela' =>
array (size=3)
0 => string '2017-08-31' (length=10)
1 => string '2017-09-30' (length=10)
2 => string '2017-10-31' (length=10)
'nro_parcela' =>
array (size=3)
0 => string '1' (length=1)
1 => string '2' (length=1)
2 => string '3' (length=1)
'quitacao' => string 'N' (length=1)
private 'CatId' => null
private 'Error' =>
array (size=2)
0 => string 'SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '2' for column 'dta_pedido' at row 1' (length=105)
1 => string 'error' (length=5)
private 'Result' => boolean false