How to show all the tables from multiple databases

Posted by saorabh on Stack Overflow See other posts from Stack Overflow or by saorabh
Published on 2010-06-12T07:22:14Z Indexed on 2010/06/12 7:32 UTC
Read the original article Hit count: 237

Filed under:

How to select all the tables from multiple databases in mySql.. I am doing the following steps but not able to achive the goal.

<?php
$a = "SHOW DATABASES";
$da = $wpdb->get_results($a);

foreach($da as $k){
echo '<pre>';
print_r ($k->Database);//prints all the available databases
echo '</pre>';
$nq = "USE $k->Database";//trying to select the individual database
$newda = $wpdb->get_results($nq);
$alld = "SELECT * FROM $k->Database";
$td = $wpdb->get_results($alld);
var_dump($td);//returns empty array
}
?>

Please Help me

© Stack Overflow or respective owner

Related posts about mysql