1
現在、MySQLデータベースに接続しているPHPで書かれたコードがあります。私は、DB2への接続を変更したい、それが現在のようになります。あなたが見ることができるようにPHPでDB2に接続する(MySQLから変更する)
$this->connection = db2_connect($this->db_host, $this->username, $this->pwd);
if(!$this->connection) {
$this->HandleDBError("failed to connect to database");
return false;
}
if(!mysql_select_db($this->database, $this->connection)) {
$this->HandleDBError('Failed to select database '.$this->database.' See if the database name is correct ');
return false;
}
if(!mysql_query("SET NAMES 'UTF8'",$this->connection)) {
$this->HandleDBError('Error setting utf8 encoding');
return false;
}
return true;
は、私は小さな変化(db2_connect
)を行いました。 DB2の場合、mysql_select_db
とmysql_query
に相当するものは何ですか? (はい、私はいくつかのMySQLのステートメントが更新されていることを知っていますが、それでも動作しますか?変更が必要な場合)