SHARE
TWEET

database connection info (DRY)

bu2chlc Nov 16th, 2019 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     // the database credentials and connection are stored in this file and included in each php page
  3.  
  4.     // db connection credentials
  5.     $db_user="imageuser";
  6.     $db_pass="password";
  7.     $db_host="localhost";
  8.     $db_name="images";
  9.  
  10.     $conn= mysqli_connect($db_host, $db_user, $db_pass, $db_name);
  11.     if($conn->connect_errno)
  12.     {
  13.       // if there is a connection error, print the error
  14.       printf("Connect failed: %s\n", $conn->connect_error);
  15.      
  16.       // handle the error or even die, why continue if there is no db connection.
  17.       die();
  18.     }
  19.     ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top