1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| $sql = <<<'SQL'
INSERT INTO CIQ (
Type , LaDate , Poste , Analyte ,
Analyse , Serum , Lot , Niveau ,
Statut , Moyenne , EcartType , Mesure ,
Etat , Westgard , Commentaire , Alarme ,
Origine , Actif )
SELECT
:Type , :LaDate , :Poste , :Analyte ,
:Analyse , :Serum , :Lot , :Niveau ,
:Statut , :Moyenne , :EcartType , :Mesure ,
:Etat , :Westgard , :Commentaire , :Alarme ,
:Origine , :Actif
WHERE NOT EXISTS (
SELECT 1
FROM CIQ
WHERE Poste = :CompPoste
)
SQL;
if ( $reponse = $bdd->prepare($sql) ) {
$columnsName = [
':Type', ':LaDate', ':Poste', ':Analyte', ':Analyse', ':Serum',
':Lot', ':Niveau', ':Statut', ':Moyenne', ':EcartType', ':Mesure',
':Etat', ':Westgard', ':Commentaire', ':Alarme', ':Origine', ':Actif'
];
// On boucle le csv ici
$placeholders = array_combine($columnsName, $column);
$placeholders[':CompPoste'] = $column[2];
$reponse->execute($placeholders);
// jusque là
} |
Partager