Read all tables in a mysql database and mysqltable
Let's first look at the Code:
<?phprequire 'class/db.php'; $sql = "select * from information_schema.tables where table_schema='ecshop' and table_type='base table' order by TABLE_ROWS desc "; $arr = $db->queryArray($sql); //var_dump($arr);foreach ($arr as $k => $v) { $tbname = $v->TABLE_NAME; $rows = $v->TABLE_ROWS; echo $tbname.' - '; echo $rows; echo '<br>';}?>
TABLE_NAME table name
Number of TABLE_ROWS table records
The length of DATA_LENGTH data.
["TABLE_CATALOG"] =>
NULL
["TABLE_SCHEMA"] =>
String (10) "leo_ecshop"
["TABLE_NAME"] =>
String (9) "ecs_goods"
["TABLE_TYPE"] =>
String (10) "base table"
["ENGINE"] =>
String (6) "MyISAM"
["VERSION"] =>
String (2) "10 ″
["ROW_FORMAT"] =>
String (7) "Dynamic"
["TABLE_ROWS"] =>
String (1) "7 ″
["AVG_ROW_LENGTH"] =>
String (3) 286 ″
["DATA_LENGTH"] =>
String (4) 2008 ″
["MAX_DATA_LENGTH"] =>
String (15) 281474976710655 ″
["INDEX_LENGTH"] =>
String (5) 11264 ″
["DATA_FREE"] =>
String (1) "0 ″
["AUTO_INCREMENT"] =>
String (1) "8 ″
["CREATE_TIME"] =>
String (19) "22:27:40 ″
["UPDATE_TIME"] =>
String (19) 2016-12-04 11:25:55 ″
["CHECK_TIME"] =>
String (19) 2016-12-04 11:19:50 ″
["TABLE_COLLATION"] =>
String (15) "utf8_general_ci"
["CHECKSUM"] =>
NULL
["CREATE_OPTIONS"] =>
String (0) ""
["TABLE_COMMENT"] =>
String (0) ""