Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($nom))
- {
- try
- {
- $bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '');
- }
- catch(Exception $e)
- {
- die('Erreur : '.$e->getMessage());
- }
- $nom = $_POST['nom'];
- $req = $bdd->prepare('INSERT INTO(nom,possesseur,console,prix,nbre_joueurs_max,commentaires) VALUES(:nom,\'Jean\',\'xbox\',50,67,\'fin voila quoi\')');
- $req->execute(array('nom' => $nom));
- echo 'Le jeux ' . $nom . ' à bien été inserée dans la base de données.';
- }
- else
- {
- ?>
- <form method="post" action="#">
- <input type="text" name="nom"/>
- <input type="submit" value="inserer"/>
- </form>
- <?php
- }
- ?>
Add Comment
Please, Sign In to add comment