function mylink() { global $DBNAME, $DBUSER, $DBPASS, $DBHOST; $plink = mysql_connect($DBHOST, $DBUSER, $DBPASS); mysql_query("set names 'utf8'", $plink); //UTF-8一定要有這行 $result = mysql_select_db($DBNAME); if ($result) { return $plink; } else { myerr($plink); return 0; } }
if( array_key_exists('charset',$_POST) && $_POST['charset'] != '' ) mysql_query( '/*!40101 SET NAMES \'' . $_POST['charset'] . '\' */' ) or myerr('can not set character set'); $result = FALSE; mysql_free_result( mysql_query( 'BEGIN' ) ); for( $rn = 1; $rn < 1000; ++$rn ) { if( !array_key_exists( 'r'.$rn, $_POST ) ) break; $data = 'OK:'; $req = $_POST['r'.$rn]; if( $req == 'connect' ) { dump( mysql_get_server_info() ); dump( mysql_get_client_info() ); dump( mysql_get_proto_info() ); dump( mysql_get_host_info() ); } else { $result = mysql_query($req) or myerr('unknown query execution error'); if( $result === TRUE ) { dump( 0 ); dump( mysql_affected_rows() ); } else { $width = mysql_num_fields($result); $height = mysql_num_rows($result); dump($width); dump($height); for( $i = 0; $i < $width; ++$i ) { dump( mysql_field_name( $result, $i ) ); $type = mysql_field_type( $result, $i ); $len = mysql_field_len( $result, $i ); $meta = mysql_fetch_field( $result, $i ); $sflags = explode( ' ', mysql_field_flags ( $result, $i ) ); $fl = 0;