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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| <?php
try {
$strConnection = 'mysql:host=localhost;dbname=epi';
$arrExtraParam= array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8");
$pdo = new PDO($strConnection, 'root', '', $arrExtraParam);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e) {
$msg = 'ERREUR PDO dans ' . $e->getFile() . ' L.' . $e->getLine() . ' : ' . $e->getMessage();
die($msg);
}
/*$logs=$_POST['log'];
$pass=$_POST['pass'];
$req = "SELECT passe FROM passe WHERE log='$logs'";
$query = mysql_query($req) or die ("il y a un probleme avec le login");
$data = mysql_fetch_array($query, MYSQL_ASSOC);
$passe=$data['passe'];
if ($pass==$passe and $pass!="" and $logs!="" and $pass=="admin")
{*/
$codeEPI=$_POST['codeEPI'];
$nom=$_POST['nom'];
$Seuil=$_POST['seuil'];
$taille=$_POST['taille'];
$marque=$_POST['marque'];
$commentaire=$_POST['commentaire'];
$i=1; $id1=0;
$query = 'INSERT INTO `epi`.`article` (`code_EPI`,`Nom_EPI`,`taille`,`Seuil`,`marque`,`commentaire`) VALUES ('.$codeEPI.','.$nom.','.$taille.','.$Seuil.','.$marque.','.$commentaire.')';
$mes = $pdo->prepare( $query, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$a=$mes->execute(array(
"code_EPI" => $codeEPI,
"Nom_EPI" => $nom,
"taille" => $taille,
"Seuil" => $Seuil,
"marque" => $marque,
"commentaire" => $commentaire
));
if ($a == TRUE ){
die ('Enrégistrement effectué');
}
else {
die ('Enrégistrement non effectué');
}
?>
<center> |
Partager