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
| <?php
header( 'content-type: text/html; charset=utf-8' );
try {
$strConnection = 'mysql:host=**;dbname=**'; //Ligne 1
$arrExtraParam= array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"); //Ligne 2
$pdo = new PDO($connStr, '**', '**', $arrExtraParam); //Ligne 3; Instancie la connexion
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);//Ligne 4
}
catch(PDOException $e) {
$msg = 'ERREUR PDO dans ' . $e->getFile() . ' L.' . $e->getLine() . ' : ' . $e->getMessage();
die($msg);
}
$Id = $_POST['id'];
$Nom = $_POST['Nom'];
$Email = $_POST['Email'];
$Adresse = $_POST['Adresse'];
$Naissance = $_POST['Naissance'];
$Tel_Fixe = $_POST['Tel_Fixe'];
$Tel_Port = $_POST['Tel_Port'];
$Date = $_POST['Date'];
$Secu = $_POST['Secu'];
$Plat= $_POST['Plat'];
$Dessert = $_POST['Dessert'];
$Commentaire = $_POST['Commentaire'];
$query = 'UPDATE pb_cuisinez SET Date=?, Plat=?, Nom=?, Mail=?, Tel=?, Message=?, TelPort=?, Secu=?, Dessert=?, Adresse=?, DateNaissance=? WHERE ID=?';
$prep = $pdo->prepare($query);
$prep->bindValue(1, $Date, PDO::PARAM_STR);
$prep->bindValue(2, $Plat, PDO::PARAM_FLOAT);
$prep->bindValue(3, $Nom, PDO::PARAM_STR);
$prep->bindValue(4, $Email, PDO::PARAM_FLOAT);
$prep->bindValue(5, $Tel_Fixe, PDO::PARAM_STR);
$prep->bindValue(6, $Commentaire, PDO::PARAM_FLOAT);
$prep->bindValue(7, $Tel_Port, PDO::PARAM_STR);
$prep->bindValue(8, $Secu, PDO::PARAM_FLOAT);
$prep->bindValue(9, $Dessert, PDO::PARAM_STR);
$prep->bindValue(10, $Adresse, PDO::PARAM_STR);
$prep->bindValue(11, $Naissance, PDO::PARAM_FLOAT);
$prep->bindValue(12, $Id, PDO::PARAM_FLOAT);
$prep->execute();
$prep = NULL;
?> |
Partager