显示sql所有表并使用类似导航显示列

I'm trying to display all table list from a proper database and want to show list of table in link or navigation format when I click on proper table name then I can see all column of that table.

I can display all list of table by this code:

mysql_select_db("dj", $con);

$result = mysql_query("show tables"); t
while($table = mysql_fetch_array($result)) 

    echo($table[0] . "<BR>");
}

By this code I'm sucess to display all table from a database but I want code for display all rows of proper table where table name will be show like link or navigation.

  1. SHOW COLUMNS FROM tablename will give you column list for a specific table
  2. Anchor tags that might look like this <a href="columns.php?table=tablename">tablename</a> will help you create your links
  3. $_GET['table'] will allow you to get a parameter passed with a url

Now, how to query the db and traverse the resultset you already know, therefore you just need to put some effort and glue it all together.

And please, don't use mysql_* functions for new code. They are deprecated. Use prepared statements with either PDO or MySQLi.