prepare("SHOW TABLES;"); $ar = array(); if ($stmp->execute() !== false) { while (($row = $stmp->fetch(PDO::FETCH_ASSOC)) !== false) { if (isset($row["Tables_in_crm"]) and (($row["Tables_in_crm"]."") != "")) { $table = $row["Tables_in_crm"]; $stmp2 = $pdo->prepare("SELECT count(*) as `count` FROM `$table`;"); $count = 0; if ($stmp2->execute() !== false) { if ((($row2 = $stmp2->fetch(PDO::FETCH_ASSOC)) !== false) and isset($row2["count"])) { $count = $row2["count"] * 1; } } echo "Таблица: " . $table . " (полей: $count)\n"; $stmp2 = $pdo->prepare("SHOW COLUMNS FROM `$table`;"); if ($stmp2->execute() !== false) { while (($row2 = $stmp2->fetch(PDO::FETCH_ASSOC)) !== false) { if (isset($row2["Field"]) and (($row2["Field"]."") != "") and isset($row2["Type"]) and (($row2["Type"]."") != "") and ($row2["Type"] == "char(36)")) { $ar[] = $row2["Key"]; echo "" . $row2["Field"] . " " . $row2["Null"] . " " . $row2["Key"] . "\n"; } } } } } }