警告:mysqli\u select\u db()期望参数1是mysqli,字符串在第34行的c:\xampp\htdocs\account\classes\class.sql.php中给出

wgeznvg7  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(199)

我是新来的 mysqli_* 我得到了这些错误:
警告:mysqli\u select\u db()要求参数1为mysqli,字符串在第34行的c:\xampp\htdocs\account\classes\class.sql.php中给出
从php5改为php7代码时出错:

private static function select_db() {

    if ( Sql::$base != NULL )
        Sql::$db = mysqli_select_db(Sql::$base, Sql::$connect);

}

这是申报代码:

Class Sql {
  private static $host;             // Host tobeconnected
  private static $user;             // User name
  private static $password;         // Password
  private static $base;             // Database

    private static $connect;    // Connection resource
    private static $db;             // Database resource

    private function Sql() {}

    // Connects to the host
    public static function connect($Host, $User, $Password, $Base) {

        Sql::$host  = $Host;
        Sql::$user  = $User;
        Sql::$password = $Password;
        Sql::$base  = $Base;

        Sql::$connect = mysqli_connect(Sql::$host, Sql::$user, Sql::$password);
        Sql::select_db();

        return Sql::$connect;
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题