Skip to content

Instantly share code, notes, and snippets.

@operateur-mar
Created October 31, 2018 11:17
Show Gist options
  • Select an option

  • Save operateur-mar/d8a8480ad2e197aacf14122bf0a7449b to your computer and use it in GitHub Desktop.

Select an option

Save operateur-mar/d8a8480ad2e197aacf14122bf0a7449b to your computer and use it in GitHub Desktop.
<?php
/* Create Database configuration */
$server = "localhost";
$username = "root";
$password = "";
$database = "Library";
/* Begin Connection */
try{
/* Setup PDO Connection */
$connection = new PDO("mysql:host=$server;dbname=$database",$username,$password);
echo " Connected ! ";
}catch(PDOException $e){
/* Any connection Errors */
echo "Error : " . $e->getMessage();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment