Guest User

Untitled

a guest
Feb 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.59 KB | None | 0 0
  1. <?php
  2. if(isset($nom))
  3. {
  4. try
  5. {
  6. $bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '');
  7. }
  8. catch(Exception $e)
  9. {
  10. die('Erreur : '.$e->getMessage());
  11. }
  12. $nom = $_POST['nom'];
  13.  $req = $bdd->prepare('INSERT INTO(nom,possesseur,console,prix,nbre_joueurs_max,commentaires) VALUES(:nom,\'Jean\',\'xbox\',50,67,\'fin voila quoi\')');
  14.  $req->execute(array('nom' => $nom));
  15.     echo 'Le jeux ' . $nom . ' à bien été inserée dans la base de données.';
  16. }
  17. else
  18. {
  19. ?>
  20. <form method="post" action="#">
  21. <input type="text" name="nom"/>
  22. <input type="submit" value="inserer"/>
  23. </form>
  24. <?php
  25. }
  26. ?>
Add Comment
Please, Sign In to add comment