Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // $servername = cpanel->server information->shared ip address
- $servername = "example.com";
- // username used to connect to cpanel
- $username = "user";
- // password used to connect to cpanel
- $password = "pass";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=database_name", $username,
- $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- echo "Connected successfully";
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
- ?>
Add Comment
Please, Sign In to add comment