In fact, we used only the MySQL tutorial show usage in fact one, in the MySQL simple operation as follows
Show Table
This will show all the tables, but in the PHP tutorial, we'll look at the following code
$server = ' localhost ';
$user = ' root ';
$pass = ';
$dbname = ' dayanmei_com ';
$conn = mysql_connect ($server, $user, $pass);
if (! $conn) Die ("Database tutorial system Connection failed!") ");
mysql_select_db ($dbname) or Die ("database connection failed!) ");
$result = mysql_query ("Show Tables");
while ($row = Mysql_fetch_array ($result))
{
echo $row [0]. "";
}
Mysql_free_result ($result);
Use the mysql_query query function to save the return table to a data so that you can iterate through it.
Other actions about show
show databases;
Show tables from db_name;
Show columns from table_name to db_name;
Show index from Talbe_name [from db_name];
Show status;
Show variables;
Show [Full] processlist;
Show table status [from db_name];
Show grants for user;
In addition to status,processlist and grants, the other can have the like wild option, which can use the SQL '% ' and ' _ ' characters;
Show databases like '%t ';
A database with the ' t ' character at the end of all database names will be listed
Of course, in these SQL, you can also use Db_name.table_name to replace table_name from db_name This will be easier to write!
If a user does not have any permissions on a table, the table is not displayed in the output in show tables or Mysqlshow db_name
You may remember describe TABLE_NAME, which achieved the same effect as show columns from Db_name.table_name