PHP implements a simple database operation class
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 );}}