MySQL common query program implemented by php. If (get_magic_quotes_gpc () 1 ){? HtmlheadtitleMySQL common query program titleheadbody note that this program requires magic_quotes_gpc in the PHP configuration file (PHP3 is php3.ini, PHP4 is php. ini) to set if (get_magic_quotes_gpc () = 1 ){
?>
MySQL common query program
Note that in this program, magic_quotes_gpc in the PHP configuration file (PHP3 is php3.ini and PHP4 is php. ini)
Set it to Off or 0. restart Apache after modification.
Exit ();
}
Set_magic_quotes_runtime (0 );
$ Host = 'localhost ';
$ Db = 'test ';
$ User = 'test ';
$ Pass = '';
// [Php/inc/str2url. php] cvs 1.2
Function str2url ($ path ){
Return eregi_replace ("% 2f", "/", urlencode ($ path ));
}
?>
MySQL common query program
If ($ cmd ){
$ Con = mysql_pconnect ($ host, $ user, $ pass) or die ('unable to connect '. $ host. 'server ');
Mysql_select_db ($ db, $ con) or die ('unable to connect '. $ db. 'database ');
$ Rst = mysql_query ($ SQL, $ con) or die ($ SQL. 'error ');
If ($ cmd = 'query '){
$ Num_fields = mysql_num_fields ($ rst );
Echo '';
Echo'
';Echo'
'. $ SQL .'';
Echo'
';For ($ I = 0; $ I <$ num_fields; $ I ++) echo'
'. Mysql_field_name ($ rst, $ I ).' | ';Echo'
';While ($ row = mysql_fetch_row ($ rst )){Echo'
';For ($ I = 0; $ I <$ num_fields; $ I ++) echo'
'. $ Row [$ I].' | ';Echo'
';}Echo'
';
Mysql_free_result ($ rst );
}
Else echo 'has'. mysql_affected_rows ($ con). 'row affected ';
}
?>
Http://www.bkjia.com/PHPjc/318050.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/318050.htmlTechArticleif (get_magic_quotes_gpc () = 1 ){? Html headtitleMySQL general query program/title/head body note that this program needs to set magic_quotes_gpc in the PHP configuration file (PHP3 is php3.ini, PHP4 is php. ini...