I'm getting Syntax error for this code... is it possible to have foreach loop inside SQL query?
try {
    $sql .= "CREATE TABLE IF NOT EXISTS `".$tbl."`(";
    foreach($columns as $column){
        $sql .= "`".$column."` VARCHAR( 250 ) NOT NULL,";
}
$sql .= "ID INT( 11 ) AUTO_INCREMENT PRIMARY KEY,";
$DB->exec($sql);
print("Created $tbl Table.\n");
} catch(PDOException $e) {
    echo $e->getMessage();//Remove or change message in production code
}
 
     
    