$dbhost = 'localhost'; // 数据库教程服务器
$dbuser = 'root'; // 数据库用户名
$dbpw = 'qwaszx'; // 数据库密码
$dbname = 'movie'; // 数据库名
$adminemail = www.111cn.net@111cn.net; // 系统管理员 email
$database = 'mysql教程'; // 不能修改此处
$tplrefresh = 1; // 模板自动刷新开关 0=关闭, 1=打开
$pconnect = 0; // 数据库连接方式 0=connect, 1=pconnect
// ============================================================================
class db_class {
var $querynum = 0;
//function dbstuff() { global $fp; $fp = fopen("./tempdata/dblog.txt", "w"); }
function connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect = 0) {
if($pconnect) {
if(!@mysql_pconnect($dbhost, $dbuser, $dbpw)) {
$this->halt('can not connect to mysql server');
}
} else {
if(!@mysql_connect($dbhost, $dbuser, $dbpw)) {
$this->halt('can not connect to mysql server');
}
}
mysql_query("set names 'gb2312'");
}
function select_db($dbname) {
return mysql_select_db($dbname);
}
function fetch_array($query, $result_type = mysql_assoc){
$query = mysql_fetch_array($query, $result_type);
return $query;
}
function query($sql, $silence = 0) {
//echo "|$sql|
"; //debug
//@fwrite($globals[fp], $sql." "); //debug
$query = mysql_query($sql);
//echo 'query:'.$query.'
';
if(!$query && !$silence)
{
$this->halt('mysql query error', $sql);
}
$this->querynum++;
return $query;
}