Advertisement
Guest User

Untitled

a guest
Mar 30th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root"; //your username
  5. $password = "root"; // your PW
  6.  
  7. try {
  8. $conn = new PDO("mysql:host=$servername;port=3307;dbname=test", $username, $password);
  9. // set the PDO error mode to exception
  10. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  11. } catch (PDOException $e) {
  12. echo "Connection failed: " . $e -> getMessage();
  13. }
  14.  
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement