mysql显示表的多维数组输出

时间:2013-06-27 18:36:05

标签: php mysql arrays multidimensional-array

我将开始使用此查询获取现有表:

    <?php
        $tblArray = array($cvsShop01, $cvsShop02, $cvsShop03, $cvsShop04, $cvsShop05);
        $dbh = new ShopSM01DB_Mysql_Extended;
        foreach($tblArray as $table) {
            $query = "SHOW TABLES LIKE '%$table%'";
            $data = $dbh->prepare($query)->execute($cvsShop01, $cvsShop02, $cvsShop03, $cvsShop04, $cvsShop05)->fetchall_assoc();
            if(!$data) {
                return false;
            } else {
                return $data;
            }
        }
    ?>

它将输出以下数组:

    <?php
        [0] => Array
        (
            [Tables_in_testTable (%table%)] => dc_01
        )
        [1] => Array
        (
            [Tables_in_testTable (%table%)] => dc_01_2
        )
    ?>

我如何用foreach读出来?

0 个答案:

没有答案