Advertisement
stevekamau

Untitled

Nov 18th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. //you can call this file init.php which has all your connetion details
  2. <?php
  3. define('DB_HOST','localhost');
  4. define('DB_USER','root');
  5. define('DB_PASSWORD',''); #for security reasons :-)
  6. define('DB_DATABASE','redwood_new');
  7.  
  8. $con = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
  9. if(!$con){
  10. echo "Connection error...".mysqli_connect_error();
  11. }else{
  12. echo "Database connection success..";
  13. }
  14.  
  15. //then call this before every file that requires it, like:
  16. <?php
  17. require "init.php";
  18. ....
  19. ....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement