& Lt ;? Phpinclude & quot; mysql. php & quot; $ db = newDirver (); $ db-& gt; DBLink ($ dbhost = & amp; #39; localhost & amp; #39 ;, $ dbuser = & amp; #39; root & amp; #39;, $ password = & amp; #39; DBLink ($ dbhost = 'localhost', $ dbuser = 'root', $ password = 'password', $ dbname = 'name', $ pconnect = 0);?> PHP connection MYSQL database class mysql. php LinkID [$ this-> Line] = ($ pconnect = 1 )? @ Mysql_pconnect ($ dbhost, $ dbuser, $ password): @ mysql_connect ($ dbhost, $ dbuser, $ password) or die ("Connect to MySQL ($ dbhost, $ dbuser) failed "); // select to connect to the database // choose to link database @ mysql_select_db ($ dbname, $ this-> LinkID [$ this-> Line]) or die ('cannot use database '. $ dbname); return $ this-> LinkID [$ this-> Line];} // query statement // view qurry function query ($ query, $ limit = '') {$ this-> nums ++; // checks whether a dataset is restricted. // Test if there is finite data, then function if ($ limit> 0) {$ query = $ query. 'limit '. $ limit;} $ this-> Lists [$ this-> Line] [] = $ query; $ querys = mysql_query ($ query, $ this-> LinkID [$ this-> Line]); if (! $ Querys) {$ this-> DB_Error ($ query);} return $ querys;} // return array Information // back to array info function fetch_array ($ query) {return @ mysql_fetch_array ($ query, MYSQL_ASSOC);} // returns the array data // back to array info function result ($ query) {return @ mysql_result ($ query, $ this-> LinkID [$ this-> Line]);} // returns the array data row // back to row info function rows ($ query) {return $ this-> fetch_array ($ this-> query ($ query);} // returns an array row // back to numrows function nums ($ query) {return $ this-> num_rows ($ this-> query ($ query);} // Obtain the number of returned columns // fetch the numbers backing out function num_rows ($ query) {return @ mysql_num_rows ($ query);} // return each field in a single column // return to every field of single row function fetch_row ($ query) {return @ mysql_fetch_row ($ query);} // returns the ID of the last INSERT command. // return to inserted ID used last time function insert_id () {return @ mysql_insert_id ($ this-> LinkID [$ this-> Line]);} // close the current database connection // close current database link function close () {return @ mysql_close ($ this-> LinkID [$ this-> Line]);} // Check mysql version // test mysql version function version () {$ query = @ mysql_query ("select version ()", $ this-> LinkID [$ this-> Line]); return @ mysql_result ($ query, 0 );} // return more friendly information http://www.52mvc.com // Return to kindly note function DB_Error_t ($ query = '') {} function DB_Error ($ query ='') {global $ PHP_SELF; // error statement prompt // error sentence $ errors = preg_replace ("/'(. + ?) '/Is ","'
// 1'", Mysql_error (); $ charset =''; // prompt language // language noted $ lang = Array ('This SQL Error Info! ', 'Error Script:', 'present time: ', 'http Host:', 'server Name: ', 'server Software:', 'host IP Address :', 'remote User Agent: ', 'Current File:', 'Current Line: ', 'line. ', 'The Error number:', 'The specific Error was: ',' SQL Query: ',' Not discover whateverly SQL Sentence! '); // Time processing // time $ nowdate = date ('Y-m-d H: I a'); $ errors = preg_replace ("/'(. + ?) '/Is ","'
// 1'", Mysql_error (); // check whether a statement exists // test if there is any sentence. if ($ query = '') {$ query = $ lang [14];} echo" $ Lang [0]
$ Lang [0] |
$ Lang [2] |
$ Nowdate |
$ Lang [3] |
". $ _ SERVER ['http _ host']." |
$ Lang [4] |
". $ _ SERVER ['server _ name']." |
$ Lang [5] |
". $ _ SERVER ['server _ soft']." |
$ Lang [6] |
". $ _ SERVER ['remote _ ADDR ']." |
$ Lang [7] |
". $ _ SERVER ['http _ USER_AGENT ']."; |
$ Lang [11] |
". Mysql_errno ()." |
$ Lang [12] |
$ Errors |
$ Lang [13] |
$ Query |
"; Exit ;}}?> PHP connection to MYSQL database DBLink ($ dbhost = 'localhost', $ dbuser = 'root', $ password = 'password', $ dbname = 'name', $ pconnect = 0);?> PHP connection MYSQL database class mysql. php LinkID [$ this-> Line] = ($ pconnect = 1 )? @ Mysql_pconnect ($ dbhost, $ dbuser, $ password): @ mysql_connect ($ dbhost, $ dbuser, $ password) or die ("Connect to MySQL ($ dbhost, $ dbuser) failed "); // select to connect to the database // choose to link database @ mysql_select_db ($ dbname, $ this-> LinkID [$ this-> Line]) or die ('cannot use database '. $ dbname); return $ this-> LinkID [$ this-> Line];} // query statement // view qurry function query ($ query, $ limit = '') {$ this-> nums ++; // checks whether a dataset is restricted. // Test if there is finite data, then function if ($ limit> 0) {$ query = $ query. 'limit '. $ limit;} $ this-> Lists [$ this-> Line] [] = $ query; $ querys = mysql_query ($ query, $ this-> LinkID [$ this-> Line]); if (! $ Querys) {$ this-> DB_Error ($ query);} return $ querys;} // return array Information // back to array info function fetch_array ($ query) {return @ mysql_fetch_array ($ query, MYSQL_ASSOC);} // returns the array data // back to array info function result ($ query) {return @ mysql_result ($ query, $ this-> LinkID [$ this-> Line]);} // returns the array data row // back to row info function rows ($ query) {return $ this-> fetch_array ($ this-> query ($ query);} // returns array rows // back t O numrows function nums ($ query) {return $ this-> num_rows ($ this-> query ($ query ));} // Obtain the number of returned columns // fetch the numbers backing out function num_rows ($ query) {return @ mysql_num_rows ($ query );} // return fields in a single column // return to every field of single row function fetch_row ($ query) {return @ mysql_fetch_row ($ query );} // return the last INSERT command ID // return to inserted ID used last time function insert_id () {return @ mysql_ I Nsert_id ($ this-> LinkID [$ this-> Line]);} // close the current database connection // close current database link function close () {return @ mysql_close ($ this-> LinkID [$ this-> Line]);} // Check mysql version // test mysql version function version () {$ query = @ mysql_query ("select version ()", $ this-> LinkID [$ this-> Line]); return @ mysql_result ($ query, 0 );} // return the friendly message // return to kindly note function DB_Error_t ($ query = '') {} function DB_Error ($ que Ry = '') {global $ PHP_SELF; // error statement prompt // error sentence $ errors = preg_replace ("/'(. + ?) '/Is ","'
// 1'", Mysql_error (); $ charset =''; // prompt language // language noted $ lang = Array ('This SQL Error Info! ', 'Error Script:', 'present time: ', 'http Host:', 'server Name: ', 'server Software:', 'host IP Address :', 'remote User Agent: ', 'Current File:', 'Current Line: ', 'line. ', 'The Error number:', 'The specific Error was: ',' SQL Query: ',' Not discover whateverly SQL Sentence! '); // Time processing // time $ nowdate = date ('Y-m-d H: I a'); $ errors = preg_replace ("/'(. + ?) '/Is ","'
// 1'", Mysql_error (); // check whether a statement exists // test if there is any sentence. if ($ query = '') {$ query = $ lang [14];} echo" $ Lang [0]
$ Lang [0] |
$ Lang [2] |
$ Nowdate |
$ Lang [3] |
". $ _ SERVER ['http _ host']." |
$ Lang [4] |
". $ _ SERVER ['server _ name']." |
$ Lang [5] |
". $ _ SERVER ['server _ soft']." |
$ Lang [6] |
". $ _ SERVER ['remote _ ADDR ']." |
$ Lang [7] |
". $ _ SERVER ['http _ USER_AGENT ']."; |
$ Lang [11] |
". Mysql_errno ()." |
$ Lang [12] |
$ Errors |
$ Lang [13] |
$ Query |
"; Exit ;}}?>