Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //PDO
- $servername = "localhost";
- $username = "root";
- $password = "";
- try {
- $pdo = new PDO("mysql:host=$servername;dbname=mydatabase", $username, $password);
- // set the PDO error mode to exception
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- echo "Connected successfully" . "<br />";
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement