Advertisement
Guest User

Untitled

a guest
Jan 13th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. ini_set('display_errors',1); // enable php error display for easy trouble shooting
  2. error_reporting(E_ALL); // set error display to all
  3.  
  4. $username = 'usename'; // username for the database
  5. $password = 'password'; // password for the database
  6. $database = 'database_name'; // name for the database
  7.  
  8. // define database connection
  9. // and stop executing the rest of the script with connection error when something goes wrong
  10. // (example: database does not exists, wrong username, wrong password etc)
  11. // new for new object. We can have multiple objects at the same time which we will cover it later
  12. $con = new mysqli("localhost",$username,$password,$database) or die("Error " . mysqli_error($con));
  13. $con->query("SET NAMES 'utf8'"); // this is for multiple languages database
  14. $con->query("SET time_zone = 'America/New_York'");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement