Tester la présence d'erreurs à la connection


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. try
  3. {
  4. $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
  5. $bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '', $pdo_options);
  6. }
  7. catch (Exception $e)
  8. {
  9. die('Erreur : ' . $e->getMessage());
  10. }
  11. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.