mysqlとmysqliの違い

4209 ワード

Mysql and Mysqli(Mysql Improved) are two library functions ( or Extension) in the PHP which is used to acces mysql database.Mysqli is the improved version of mysql which support OOPS. The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above.
mysqlは非持続接続関数であり、mysqliは永遠接続関数である.つまり
mysqlはリンクするたびに接続プロセスを開き、mysqliがmysqliを複数回実行すると同じ接続プロセスが使用され、サーバのオーバーヘッドが削減されます.
new mysqli('localhost',usenamer','password','databasename')を使用する場合.いつも間違いを報告します.Fatal error:Class'mysqli'not found in...ではmysqliが開いているかどうかをチェックします.mysqliクラスはデフォルトで開いていないので、winの下でphpを変更します.ini、phpを取り除くmysqli.dll前の;linuxの下でmysqliをコンパイルします.
 
In relation to PHP programming language, MySQL is the old database driver, and MySQLi is the Improved driver. MySQLi takes advantage of the newer features of MySQL 5. Lifted verbatim from the php.net site:
 
- Object-oriented interface- Support for Prepared Statements- Support for Multiple Statements- Support for Transactions- Enhanced debugging capabilities- Embedded server support
You have the choice of using mysql, mysqli, or PDO essentially. 
If you're simply looking for a relational database, you need look no further than MySQL, though there are many options available. You can use DBD, Postgres, MySQL, MSSQL, sqlite, etc etc etc...
HTH
Source(s):
http://www.php.net/manual/en/mysqli.over…
mysqliの使い方:
$mysqli 
= new 
mysqli
(
'localhost'

'my_user'

'my_password'

'my_db'
);
mysqlの使い方:$link mysql_connect('example.com:3307''mysql_user''mysql_password'); $link mysql_connect('example.com:3307''mysql_user''mysql_password'); mysql_query("set names utf8");【 】: utf-8 mysql_select_db("my_db");
mysqliを使用する場合、データベース名はmysqliの構築方法のパラメータとして使用されるため、接続文字セットを設定することはできません(私が使っている方法が間違っているかもしれませんが、いろいろな方法を試してみましたが、mysqliを使用するときは中国語が文字化けしていました).