Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il
Hostgator 1 Penny

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,849 questions

9,751 answers

573 users

How to show all tables from MySQL Dadabase in PHP

1 Answer

0 votes
$db_host       = 'localhost';
$db_user       = 'username';
$db_pass       = 'password';
$db_database   = 'database_name';
 
$con = mysql_connect($db_host, $db_user, $db_password) or die('Unable to connect to DB');
mysql_select_db($db_database, $con);

// change only the database_name
$sql = "SELECT table_name, table_type, engine
        FROM information_schema.tables
        WHERE table_schema = 'database_name'
        ORDER BY table_name";

$result = mysql_query($sql, $con);
if ( ! $result ) die("Line: " . __LINE__  . " Error: ". mysql_error());

while ($row = mysql_fetch_array($result))
{
    echo $row['table_name'] . " | " . $row['table_type'] . " | " . $row['engine'] . "<br>";
}



answered Oct 16, 2014 by avibootz
edited Oct 16, 2014 by avibootz
...