您好,欢迎访问一九零五行业门户网

懂PHP和MYSQL的请进 ---------请教统计数量

原始效果
--------------------------------------------------
数据库总量:
490766329
数据库大小:
25115924452
---------------------------------------------------
要达到的效果
数据库总量:
4.90亿条
数据库大小:
23.39 gb
关键代码
$e=0;
$count=mysql_query(select table_name from information_schema.tables where table_schema='data');   
while($rows=mysql_fetch_array($count)){
$c= $rows['table_name'];
$count_table=mysql_query(select count(*) from  $c);
while(@$d=mysql_fetch_array($count_table)){
$e= $e+($d['count(*)']);
}
}
?>
数据库总量:
> 亿条
占用空间:
23.39gb
后面的gb没定义 请帮忙弄下 谢谢了
参考代码 http://www.douban.com/note/139003240/
回复讨论(解决方案) 只会用笨办法了; $a = 490766329;$b = 25115924452;echo number_format(floor($a*pow(10, -6))*pow(10, -2),2);echo number_format($b/pow(1024,3),2).'gb';
$sql = select sum(table_rows) as 记录数, sum(data_length+index_length) as 占用空间 from information_schema.tables where table_schema='data';$rs = mysql_query($sql);print_r(mysql_fetch_assoc($rs));
其它类似信息

推荐信息