Mysql.class.php 文件见 http://www.jb51.net/article/25496.htm
// 包含Mysql操作类
include_once 'Mysql.class.php';
// 本地mysql数据
$mysql_local_data = array('db_host'=>'localhost',
'db_user'=>'root',
'db_pass'=>'root',
'db_name'=>'test');
// 远程mysql数据
$mysql_remote_data = array('db_host'=>'61.183.41.178',
'db_user'=>'XXX',
'db_pass'=>'XXX',
'db_name'=>'XXX');
// 公用数据
$tb_prefix = 'php95_';
$db_charset = 'UTF-8';
//本地连接成功则实例化本地Mysql类,否则连接远程数据库并实例化Mysql类
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], $mysql_remote_data[db_pass], $mysql_remote_data[db_name], $db_charset, $conn);
$db->show_tables(); //测试:显示当前数据库下的所有表名
?>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn