简体   繁体   English

我如何将 MYSQLI 连接调用到公共函数中?

[英]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错误:警告:mysqli_real_escape_string() 期望参数 1 为 mysqli,第 768 行 \\classes.php 中给出的 null

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这应该做

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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