<?php Tutorial
$dbhost = ' localhost '; Database Tutorial Server
$dbuser = ' root '; Database user Name
$DBPW = ' QWASZX '; Database Password
$dbname = ' movie '; Database name
$adminemail = www.111cn.net@111cn.net; System Administrator Email
$database = ' MySQL tutorial '; Cannot modify here
$tplrefresh = 1; Template Auto Refresh Switch 0 = close, 1 = Open
$pconnect = 0; Database connection mode 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 |<br>"; Debug
//@fwrite ($globals [FP], $sql. " "); Debug
$query = mysql_query ($sql);
echo ' query: '. $query. ' <br> ';
if (! $query &&! $silence)
{
$this->halt (' MySQL query error ', $sql);
}
$this->querynum++;
return $query;
}