Nhận số lượng truy vấn MySQL mọi thời điểm - Thủ thuật CSS

Anonim
=50002) ( $sql="SHOW GLOBAL STATUS LIKE 'Questions'"; ) else ( $sql="SHOW STATUS LIKE 'Questions'"; ) (email protected)_query( $sql ); (email protected)_fetch_array( $result ); return $row('Value'); ) //helper function is needed to detect the exact mysql-version function getMysqlVersion() ( $sql = 'SELECT VERSION() AS versionsinfo'; $result = @mysql_query('SELECT VERSION() AS versionsinfo'); $version = @mysql_result( $result, 0, "versionsinfo" ); $match = explode('.',$version); return sprintf('%d%02d%02d',$match(0),$match(1),intval($match(2))); ) ?>

Vì tên của biến tình trạng-mysql toàn cục chứa số lượng truy vấn đã thay đổi trong các phiên bản sau của mysql, nên cần có hàm trợ giúp để phát hiện phiên bản chính xác của mysql mà bạn đang chạy.