query("SHOW COLUMNS FROM `$t`"); $has = false; while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { if($row['Field'] == 'outlet_id') $has = true; } if($has) echo "$t has outlet_id\n"; else echo "$t missing outlet_id\n"; } catch (Exception $e) { echo "Error on $t: " . $e->getMessage() . "\n"; } }