Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera,
Estou tentando gravar multi registros no MySQL, está complicado!!!
Tenho a seguinte saida no meu $_POST:
string(11) "0.A.004.491" string(11) "6.B.200.101" string(33) "BULK MASSA BASE BATOM MATTE - DDP" string(6) "17,303"
string(5) "0.000" string(11) "0.A.004.491" string(11) "2.P.335.101" string(12) "CERAPHYL 791" string(5) "0,346" string(7) "191.800"
string(11) "0.A.004.491" string(11) "2.P.355.101" string(12) "BENTONE 38 V" string(5) "0,692" string(7) "104.840"
string(11) "0.A.004.491" string(11) "2.P.075.101" string(44) "FILTRO SOLAR - METOXICINAMATO DE ETIL HEXILA" string(5) "0,087" string(6) "12.222"
string(11) "0.A.004.491" string(11) "2.P.152.101" string(11) "TINOGARD TL" string(5) "0,035" string(5) "6.132"
string(11) "0.A.004.491" string(11) "2.P.376.101" string(13) "BENZOFENONA 3" string(5) "0,087" string(6) "27.055"
string(11) "0.A.004.491" string(11) "2.P.342.101" string(30) "PIG DIOXIDO DE TITANIO ANATASE" string(5) "2,028" string(7) "929.426"
string(11) "0.A.004.491" string(11) "6.B.200.101" string(33) "BULK MASSA BASE BATOM MATTE - DDP" string(6) "17,303"
string(5) "0.000" string(11) "0.A.004.491" string(11) "2.P.335.101" string(12) "CERAPHYL 791" string(5) "0,346" string(7) "191.800"
string(11) "0.A.004.491" string(11) "2.P.355.101" string(12) "BENTONE(11) "0.A.004.491" string(11) "2.P.340.101" string(22) "PIG RED 7 D&C A-502.14" string(5) "0,588" string(7) "157.606"
string(11) "0.A.004.491" string(11) "2.P.352.101" string(19) "PIG RED 6 D&C A-506" string(5) "0,471" string(6) "60.612"
string(11) "0.A.004.491" string(11) "2.P.366.101" string(19) "PIG RED 3 D&C A-503" string(5) "0,706" string(7) "186.843"
string(11) "0.A.004.491" string(11) "2.P.394.101" string(23) "PIG RED 27 D&C A-511.01" string(5) "1,440" string(6) "25.000"
string(11) "0.A.004.491" string(11) "2.P.365.101" string(23) "PIG VIOLETA DE MANGANES" string(5) "2,087" string(6) "71.794"
string(11) "0.A.004.491" string(11) "2.P.329.101" string(14) "OLEO DE RICINO" string(5) "6,731" string(7) "798.064"
string(11) "0.A.004.491" string(11) "2.P.121.101" string(8) "DALPAR L" string(5) "1,038" string(7) "765.400"
string(11) "0.A.004.491" string(11) "2.P.300.101" string(17) "MAXXI SILK POWDER" string(5) "0,692" string(7) "101.647"
string(11) "0.A.004.491" string(11) "2.P.339.101" string(11) "AEROSIL 200" string(5) "0,173" string(7) "111.925"
string(11) "0.A.004.491" string(11) "2.E.005.101" string(35) "ES LAP 205379 BOUQUET CHOCO FLAVOR " string(5) "0,104" string(6) "45.290"
Correspondente aos seguintes campos:
fo_cod_aca, fo_cod_pro, fo_descri_mp, fo_kg_mp, ee_ID, ee_estoque.
Estou tentando gravar conforme esse script:
<?php
require_once 'sys_init.php';
if (isset($_POST)){
$fo_cod_aca = $_POST['fo_cod_aca'];
$fo_cod_pro = $_POST['fo_cod_pro'];
$fo_descri_mp = $_POST['fo_descri_mp'];
$fo_kg_mp = $_POST['fo_kg_mp'];
$ee_ID = $_POST['ee_ID'];
$ee_estoque = $_POST['ee_estoque'];
$ext = implode(', ', $fo_cod_aca);
$ext = implode(', ', $fo_cod_pro);
$ext = implode(', ', $fo_descri_mp);
$ext = implode(', ', $fo_kg_mp);
$ext = implode(', ', $ee_ID);
$ext = implode(', ', $ee_estoque);
for ($i=0; $i<=count($ext); $i++) {
$CALL = db_connect();
$stmt = $CALL ->prepare("INSERT INTO tab_for_temp
(
fo_cod_aca,
fo_cod_pro,
fo_descri_mp,
fo_kg_mp,
ee_ID,
ee_estoque
)
VALUES
(
fo_cod_aca ='".$ext[$i]."',
fo_cod_pro ='".$ext[$i]."',
fo_descri_mp ='".$ext[$i]."',
fo_kg_mp ='".$ext[$i]."',
ee_ID ='".$ext[$i]."',
ee_estoque ='".$ext[$i]."'
)
");
$stmt->execute(array($ext[$i]));
}
}
header('Location: op_fo_escolher_pdo.php');
?>
Só grava uma linha, com os campos preenchidos com 1
Agradeço qualquer auxilio.
Cordialmente,
WalterCarregando comentários...