SHOW DATABASE;
SHOW TABLES FROM `mysql`
SHOW FIELDS FROM `user`;
为什么不看看 MySQL 手册呢,下一个 MySQL-Front
或 MySQL Control Center
都对你的学习有事半功倍之效
SHOW TABLES FROM `mysql`
SHOW FIELDS FROM `user`;
为什么不看看 MySQL 手册呢,下一个 MySQL-Front
或 MySQL Control Center
都对你的学习有事半功倍之效
以防数据表有同名,不用"SHOW FIELDS FROM `user`;"
代码如下:
<?php
$conn=mysql_connect("localhost","root","");
$select=mysql_select_db("your_db_name",$conn);$sql="SHOW TABLES FROM `your_db_name`";
$query=mysql_query($sql,$conn);
while($rc_table=mysql_fetch_row($query)){
print "table:".$rc_table[0]."<br>";
$result_fields=mysql_list_fields("your_db_name", $rc_table[0], $conn);
$num_fields=mysql_num_fields($result_fields);
for($i=0;$i<$num_fields;$i++)print mysql_field_name($result_fields,$i)."<br>";
}
?>