Advertisement
Skorpius

MySQLI Connection

Feb 1st, 2023 (edited)
1,121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. <?php
  2.  
  3.     defined('BASEPATH') OR exit('Direct script access is not permitted');
  4.     # define('BASEPATH', true); //This line must go at the top of viewable pages without the #
  5.  
  6.     $server = "localhost";
  7.     $username = "Your_UserName";
  8.     $password = "Your_Password";
  9.     $database = "Your_Database_Name";
  10.  
  11.     $dbc= new mysqli($server,$username,$password,$database);
  12.  
  13.     if(!$dbc){
  14.         die("Connection failed:" . mysqli_connect_error());
  15.     }
  16. /*
  17.     //Confirms you are connected
  18.     else{
  19.         echo "Connected to $database";
  20.     }
  21. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement