查看自增id
$sql="select Auto_increment from information_schema.tables where TABLE_SCHEMA='{$数据库名}' and TABLE_NAME='{$表名}'"; $result=mysqli_query($con,$sql); $row = mysqli_fetch_assoc($result); echo $row['Auto_increment'];
查看 行数 数据大小 行均大小 索引大小 多余
$sql="select TABLE_NAME,data_length,index_length,DATA_FREE,TABLE_ROWS,Auto_increment,Avg_row_length from information_schema.tables where TABLE_SCHEMA = '{$数据库名}' group by TABLE_NAME order by data_length desc;"; echo "<table><tr><td>表名</td><td>自增id</td><td>行数</td><td>数据大小</td><td>行均大小</td><td>索引大小</td><td>多余</td></tr>"; $result=mysqli_query($con,$sql); if($result){ while($row = mysqli_fetch_assoc($result)) { echo "<tr>"; $row['data_length']=getSize($row['data_length']); $row['index_length']=getSize($row['index_length']); $row['DATA_FREE']=getSize($row['DATA_FREE']); $row['Avg_row_length']=getSize($row['Avg_row_length']); echo "<td>{$row['TABLE_NAME']}</td>"; echo "<td>{$row['Auto_increment']}</td>"; echo "<td>{$row['TABLE_ROWS']}</td>"; echo "<td>{$row['data_length']}</td>"; echo "<td>{$row['Avg_row_length']}</td>"; echo "<td>{$row['index_length']}</td>"; echo "<td>{$row['DATA_FREE']}</td>"; echo "</tr>"; } } echo "</table>";