Thread: Something Else
View Single Post
  #12  
Old 11th May 2016, 10:46
l3on l3on is offline
Coder
 
Join Date: Jul 2012
Posts: 154
Default
PHP Code:
function dbconnect(){
    global 
$DB_host;
    global 
$DB_user;
    global 
$DB_pass;
    global 
$DB_name;
    global 
$DB_port;
    
$dbClass = new MysqliDb($DB_host,$DB_user,$DB_pass,$DB_name);
    return 
$dbClass;

put above in function.php

and for config.php use below code

PHP Code:
  $DB_host "localhost";
  
$DB_user "user";
  
$DB_pass "yourpassword";
  
$DB_name "databasename";
  
$DB_port 3306;
  
  
$db = new Mysqli($DB_host,$DB_user,$DB_pass,$DB_name);
  if(
$MySQLi_CON->connect_errno) {
    die(
"ERROR : -> ".$MySQLi_CON->connect_error);

you welcome

you may also need to include this file MysqliDb.php witch is the class file here link https://github.com/joshcam/PHP-MySQLi-Database-Class
Reply With Quote