Ec (2); & lt ;? Php tutorial & nbsp; $ dbhostlocalhost; & nbsp; database tutorial Server & nbsp; $ dbuserroot; & nbsp; database username & nbsp; $ dbpwqwaszx; & nbsp; script ec (2); script
$ Dbhost = 'localhost'; // database tutorial Server
$ Dbuser = 'root'; // database username
$ Dbpw = 'qwaszx'; // Database Password
$ Dbname = 'movie '; // Database Name
$ Adminemail = www.111cn.net@111cn.net; // System Administrator email
$ Database = 'mysql example'; // you cannot modify it here.
$ Tplrefresh = 1; // The automatic template refresh switch 0 = off, 1 = on
$ Pconnect = 0; // database connection method 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;
}
Homepage 1 2 3 last