PHP implements a simple database operation class. PHP implements a simple database operation Class PHP to implement a simple database operation class function: -set the connected character set during instantiation-a simple database operation class implemented by PHP during instantiation
PHP implements a simple function of the database operation class: -you can set the connection character set during instantiation-connect to the database during instantiation-select the default database during instantiation-disable the database code when destroying objects as follows:
Server = $ server; $ this-> username = $ username; $ this-> password = $ password; $ this-> default_db = $ default_db; // connect to the database $ this-> link = mysql_connect ($ this-> server, $ this-> username, $ this-> password); if (! $ This-> link) {echo 'database connect failure! ';} // Set the default database $ bool = mysql_select_db ($ this-> default_db, $ this-> link); if (! $ Bool) {echo 'Select default_db failure! ';}}// Declare the destructor public function _ destruct () {mysql_close ($ this-> link );}}
PHP implements a simple function of database operation class:-connection character set can be set during instantiation-during instantiation...