Created
January 13, 2022 17:46
-
-
Save tararoutray/2c850d1d8882d10b2d18d4d6541036d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Connect to the MySQL server. | |
*/ | |
try { | |
/* | |
* Provide the database credentials. | |
*/ | |
$pdo = new PDO("mysql:host=192.x.x.x;dbname=mydatabase", "tararoutray", "mystrongpassword"); | |
/* | |
* Print the success message. | |
*/ | |
echo 'Database connection has been established'; | |
} catch(PDOException $e) { | |
/* | |
* Print the error message. | |
*/ | |
die("ERROR: Could not connect. " . $e->getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment