Advertisement
Guest User

Untitled

a guest
May 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3.     <head>
  4.         <title>Saisie contact</title>
  5.     </head>
  6.     <body>
  7.         <?php
  8.         $server = "localhost";
  9.         $db = "coursPHP";
  10.         $login = "root";
  11.         $mdp = "";
  12.        
  13.        
  14.         //Connexion au serveur MySQL
  15.         try {
  16.             $connexPDO = new PDO("mysql:host=$server;dbname=$db", $login, $mdp);
  17.         }
  18.         catch (Exception $e) {
  19.             die('Erreur : ' . $e->getMessage());
  20.         }
  21.        
  22.         //Préparation de la requête
  23.         $req = $connexPDO->prepare('INSERT INTO patient(ID_patient, civilite_patient, nom_patient, prenom_patient, adresse, code_postal, ville, date_naissance, lieu_naissance, num_secu, ID_medecin)
  24.            VALUES(:ID_patient, :civilite_patient, :nom_patient, :prenom_patient, :adresse, :code_postal, :ville, :date_naissance, :lieu_naissance, :num_secu, :ID_medecin)');
  25.        
  26.        
  27.         //Exécution de la requête
  28.         $req->execute(array('ID_patient' => $_POST['ID_patient'],
  29.                             'civilite_patient' => $_POST['civilite_patient'],
  30.                             'nom_patient' => $_POST['nom_patient'],
  31.                             'prenom_patient' => $_POST['prenom_patient'],
  32.                             'adresse' => $_POST['adresse'],
  33.                             'code_postal' => $_POST['code_postal'],
  34.                             'ville' => $_POST['ville'],
  35.                             'date_naissance' => $_POST['date_naissance'],
  36.                             'lieu_naissance' => $_POST['lieu_naissance']
  37.                             'num_secu' => $_POST['num_secu'],
  38.                             'ID_medecin' => $_POST['ID_medecin']));
  39.         ?>
  40.     </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement