thông tin dữ liệu của bạn được cập nhật đến ngày bao nhiêu
- User
thông tin dữ liệu của bạn được cập nhật đến ngày bao nhiêu
- Assistant
Xin lỗi, tôi là một AI và không thể cung cấp thông tin dữ liệu của bạn được cập nhật đến ngày nào. Vui lòng kiểm tra ngày cập nhật dữ liệu trong tài khoản của bạn hoặc liên hệ với nhà cung cấp dịch vụ.
- User
sửa lại đoạn code này giúp tôi để phù hợp với phiên bản php 7. trở lên: đoạn code: pubConnect->db_connect(); class DB_DBASES { var username; var port; var database; function DB_DBASES(user = "ytebl_db", port = 3306, dbase = "ytebl_db") { host; user; pass; port; type; dbase; } function db_connect() { this->type) { case "mysql": if (empty(checkConnect = @mysql_pconnect(this->username); else: this->hostname, this->password); endif; break; case "mssql": if (empty(checkConnect = @mssql_pconnect(this->username); else: this->hostname, this->password); endif; break; } if (!this->db_display_error(); } else { @mysql_select_db(checkConnect; } function db_close() { return mysql_close(); } function db_display_error() { print "Error: " . @mysql_error(); } function db_query(this->type) { case "mysql": myStrSQL); break; case "mssql": myStrSQL); break; } if (!this->db_display_error(); } return result) { switch (result); break; case "mssql": return @mssql_fetch_array(result) { switch (result); break; case "mssql": return @mssql_num_rows($result); break; } } function db_insert_id() { return @mysql_insert_id(); } }
- Assistant
Tôi đã sửa lại đoạn mã của bạn để sử dụng PHP 7 trở lên. Nó sẽ sử dụng các hàm
mysqli_*thay vìmysql_*vàmssql_*. Tôi cũng loại bỏ phần hỗ trợ SQL Server do phần mở rộng mssql đã không được hỗ trợ trong PHP 7 trở lên.$pubConnect = new DB_DBASES(); $pubConnect->db_connect(); class DB_DBASES { private $hostname; private $username; private $password; private $port; private $database; private $connection; function __construct($host = "localhost", $user = "ytebl_db", $pass = "P}fX2+dX8B5q#a", $port = 3306, $dbase = "ytebl_db") { $this->hostname = $host; $this->username = $user; $this->password = $pass; $this->port = $port; $this->database = $dbase; } function db_connect() { $this->connection = mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port); if (!$this->connection) { $this->db_display_error(); return false; } mysqli_set_charset($this->connection, "utf8"); return true; } function db_close() { return mysqli_close($this->connection); } function db_display_error() { print "Error: " . mysqli_error($this->connection); } function db_query($myStrSQL) { $result = mysqli_query($this->connection, $myStrSQL); if (!$result) { $this->db_display_error(); } return $result; } function db_fetch_array($result) { return mysqli_fetch_array($result); } function db_num_rows($result) { return mysqli_num_rows($result); } function db_insert_id() { return mysqli_insert_id($this->connection); } }