MySQL. Class. php file see http://www.jb51.net/article/25496.htm
CopyCode The Code is as follows: <? PHP
// Contains the MySQL operation class
Include_once 'mysql. Class. php ';
// Local Mysql Data
$ Mysql_local_data = array ('db _ host' => 'localhost ',
'Db _ user' => 'root ',
'Db _ pass' => 'root ',
'Db _ name' => 'test ');
// Remote Mysql Data
$ Mysql_remote_data = array ('db _ host' => '61. 183.41.178 ',
'Db _ user' => 'xxx ',
'Db _ pass' => 'xxx ',
'Db _ name' => 'xxx ');
// Public Data
$ Tb_prefix = 'php95 _';
$ Db_charset = 'utf-8 ';
// If the local connection is successful, the local MySQL class is instantiated. Otherwise, the local database is connected and the MySQL class is instantiated.
If (@ mysql_connect ($ mysql_local_data [db_host], $ mysql_local_data [db_user], $ mysql_local_data [db_pass])
$ Db = new MySQL ($ db_host, $ mysql_local_data [db_user], $ mysql_local_data [db_pass], $ mysql_local_data [db_name], $ db_charset, $ conn );
Else
$ Db = new MySQL ($ mysql_remote_data [db_host], $ mysql_remote_data [db_user], $ response [db_pass], $ mysql_remote_data [db_name], $ db_charset, $ conn );
$ Db-> show_tables (); // test: displays the names of all tables in the current database.
?>