fix using deprecated mysql_escape_string()

This commit is contained in:
printempw 2016-08-26 17:36:57 +08:00
parent 56bfcd0b67
commit 6170144fb1

View File

@ -60,11 +60,11 @@ class Database
public function table($table_name, $no_prefix = false) public function table($table_name, $no_prefix = false)
{ {
if (mysql_escape_string($table_name) == $table_name) { if ($this->connection->real_escape_string($table_name) == $table_name) {
$this->table_name = $no_prefix ? $table_name : $this->config['prefix'].$table_name; $this->table_name = $no_prefix ? $table_name : $this->config['prefix'].$table_name;
return $this; return $this;
} else { } else {
throw new E('Table name contains invalid characters', 1); throw new \InvalidArgumentException('Table name contains invalid characters', 1);
} }
} }