faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 15 people (93%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How do you show all tables in a DB in PHP script?

Mar 6th, 2002 01:37
Nick R, SE Cash,


hello,
<!--where you see replace_ change to your info.-->
<html>
<body>
<?php
//Comment: connect to db replace username, pass, and db
$link_id = mysql_connect
("localhost", "replace_your_user_name", "replace_your_password");
$result=mysql_select_db("replace_your_database", $link_id);
/*Comment: use mysql_list_tables and replace first quotes"" with your 
database name*/ 
$result1=mysql_list_tables("replace_your_database", $link_id);
//Comment: use while loop to display results
while($data=mysql_fetch_row($result1))
{ 
  echo "<br>".$data[0]; 
}
?>
</body></html>