Welcome Guest, Not a member yet? Register   Sign In
Message: mysqli_real_escape_string() expects parameter 1 to be mysqli, boolean given
#1

i got the message

Code:
Severity: Warning

Message: mysqli_real_escape_string() expects parameter 1 to be mysqli, boolean given

Filename: mysqli/mysqli_driver.php

Line Number: 316

im connect to 3 different database with different server too

PHP Code:
$active_group 'default';
$active_record TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'app';
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

/* Dota Statistic Database Configuration */

$db['stats']['hostname'] = '49.128.182.xxx';
$db['stats']['username'] = 'xxx';
$db['stats']['password'] = 'xxx';
$db['stats']['database'] = 'anonstats';
$db['stats']['dbdriver'] = 'mysqli';
$db['stats']['dbprefix'] = '';
$db['stats']['pconnect'] = FALSE;
$db['stats']['db_debug'] = FALSE;
$db['stats']['cache_on'] = TRUE;
$db['stats']['cachedir'] = '';
$db['stats']['char_set'] = 'utf8';
$db['stats']['dbcollat'] = 'utf8_general_ci';
$db['stats']['swap_pre'] = '';
$db['stats']['autoinit'] = FALSE;
$db['stats']['stricton'] = FALSE;

/* PvPGN Database Configuration */

$db['pvpgn']['hostname'] = '49.128.182.xxx';
$db['pvpgn']['username'] = 'xxx';
$db['pvpgn']['password'] = 'xxx';
$db['pvpgn']['database'] = 'pvpgn';
$db['pvpgn']['dbdriver'] = 'mysqli';
$db['pvpgn']['dbprefix'] = '';
$db['pvpgn']['pconnect'] = TRUE;
$db['pvpgn']['db_debug'] = FALSE;
$db['pvpgn']['cache_on'] = FALSE;
$db['pvpgn']['cachedir'] = '';
$db['pvpgn']['char_set'] = 'utf8';
$db['pvpgn']['dbcollat'] = 'utf8_general_ci';
$db['pvpgn']['swap_pre'] = '';
$db['pvpgn']['autoinit'] = FALSE;
$db['pvpgn']['stricton'] = FALSE

im try to call model function username_exist

PHP Code:
class Pvpgn extends CI_Model {

    private 
$pvpgn;
    private 
$app;

    public function 
__construct()
    {
        
parent::__construct();
        
$this->pvpgn $this->load->database('pvpgn',TRUE);
        
$this->app $this->load->database('default',TRUE);
    }

    public function 
username_exist($username)
    {
        
$this->app->select('id');
        
$this->app->where('username'$username);
        
$query $this->app->get('member');

        if (
$query->num_rows() == 1) {
            return 
true;
        } else {
            
$this->pvpgn->select('uid');
            
$this->pvpgn->where('acct_username'$username);
            
$qry $this->pvpgn->get('pvpgn_BNET');

            if (
$qry->num_rows() == 1) {;
                return 
true;
            } else {
                return 
false;
            }
        }
    } 
Reply
#2

(This post was last modified: 03-10-2015, 04:24 PM by RobertSF.)

It doesn't seem to be anything you're doing. It looks like it might be an issue with your host's implementation of MySQL. Does your problem start when you move your application from your local computer to your internet host? I suppose it could also be a bug in Codeigniter. Check out thisĀ Stack Overflow question.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply
#3

Try naming the pvpgn property (your db connection) something different in your pvpgn model.
Reply
#4

The error means just that your DB connection isn't initialized yet ... set 'autoinit' to TRUE.
Reply
#5

Please, check your username and password.
Rolleyes
Reply
#6

Assuming your login details are correct try changing localhost to 127.0.0.1
Reply




Theme © iAndrew 2016 - Forum software by © MyBB