简体   繁体   中英

How i can call a MYSQLI connection into a public function?

Hey i have a problem with my variable. can you help me please ?

Error: Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in \\classes.php on line 768

class TDMCore
{

public $rsSQL;
public $isDBCon;
function DBConnect($DBType = 'MODULE')
{
    $S = $this->arConfig[$DBType . '_DB_SERVER'];
    $L = $this->arConfig[$DBType . '_DB_LOGIN'];
    $P = $this->arConfig[$DBType . '_DB_PASS'];
    $DB = $this->arConfig[$DBType . '_DB_NAME'];
    $this->rsSQL = mysqli_connect($S, $L, $P, $DB);
    $Charset = 'utf8';

    if ($this->rsSQL) {
        $this->isDBCon = true;
        mysqli_set_charset($this->rsSQL, $Charset);
        return true;

    }

    if (substr($S, 0, 12) == 'autodbase.ru') {
        $S = 'TDBase';
    }

    $this->arErrors[] = 'Error! No connection to "' . $S . '" ';
    $this->isDBCon = false;
    return false;
}
public function Select($DBTable, $arOrder, $arFilter, $arParams = array())

            $key = mysqli_real_escape_string($this->rsSQL, $key); - problem line 768
}
global  $isDBCon;
global  $rsSQL;

This should do it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM