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
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ffnpro_v2";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username,
$password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$genre_personne=$_POST["genre_personne"];
$nom_personne=$_POST["nom_personne"];
$prenom_personne=$_POST["prenom_personne"];
$age_personne=$_POST["age_personne"];
$telephone_personne=$_POST["telephone_personne"];
$email_personne=$_POST["email_personne"];
$adresse_personne=$_POST["adresse_personne"];
$codep_personne=$_POST["codep_personne"];
$ville_personne=$_POST["ville_personne"];
$pays_personne=$_POST["pays_personne"];
$type = $_POST["type"];
$centre_emetteur=$_POST["centre_emetteur"];
$licence=$_POST["licence"];
// query sql and bind parameters
$stmt = $conn->query("INSERT INTO personnes (genre_personne, nom_personne, prenom_personne, age_personne, telephone_personne,
email_personne, adresse_personne, codep_personne, ville_personne, pays_personne, type, centre_emetteur, licence,centre_emetteur_region,date_current) VALUES (:genre_personne, :nom_personne,
:prenom_personne, :age_personne, :telephone_personne, :email_personne, :adresse_personne, :codep_personne, :ville_personne, :pays_personne, :type, :centre_emetteur, :licence, :centre_emetteur_region ,CURRENT_DATE())");
$stmt->bindParam(':genre_personne', $genre_personne);
$stmt->bindParam(':nom_personne', $nom_personne);
$stmt->bindParam(':prenom_personne', $prenom_personne);
$stmt->bindParam(':age_personne', $age_personne);
$stmt->bindParam(':telephone_personne', $telephone_personne);
$stmt->bindParam(':email_personne', $email_personne);
$stmt->bindParam(':adresse_personne', $adresse_personne);
$stmt->bindParam(':codep_personne', $codep_personne);
$stmt->bindParam(':ville_personne', $ville_personne);
$stmt->bindParam(':pays_personne', $pays_personne);
$stmt->bindParam(':type', $type);
$stmt->bindParam(':centre_emetteur', $centre_emetteur);
$stmt->bindParam(':licence', $licence);
$stmt->bindParam(':centre_emetteur_region', $centre_emetteur_region);
$stmt->execute(); |
Partager