Advertisement
IARI

Untitled

Jan 23rd, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2. // Connects to the data base
  3. // To test if the connection works open the file location in your browser
  4. // The url looks something like localhost/experiments/emp/connect.php or www.yourhomepageurl/yourfoldername/connect.php
  5.     $servername = "db666156632.db.1and1.com"; //http://db666156632.db.1and1.com"; //"localhost";
  6.     $dbname = "db666156632"; //"emp";
  7.     $username = "dbo666156632"; //"root";
  8.     $password = "empPM395!!"; //"";
  9.    
  10.  
  11.     try {
  12.         //$sqlConnection = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  13.         $sqlConnection = new PDO('sqlite:$dbname.sqlite');
  14.        
  15.  
  16.         // set the PDO error mode to exception
  17.         $sqlConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  18.         //echo "Connected successfully. ";
  19.         }
  20.     catch(PDOException $e)
  21.         {
  22.         echo "Connection to data base failed, error: " . $e->getMessage();
  23.         }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement