簡體   English   中英

我如何將 MYSQLI 連接調用到公共函數中?

[英]How i can call a MYSQLI connection into a public function?

嘿,我的變量有問題。 你能幫我嗎 ?

錯誤:警告: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;

這應該做

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM