I have an array containing column names of a table i want to create which i got from an excel sheet.
I tried something like this
$sql = "CREATE TABLE IF NOT EXISTS ".$month."-".date('Y')."(
".foreach($tableColumnNames as $columnName){
echo $columnName." VARCHAR(200) NULL,";
}
."
)";
It returns error saying Parse error: syntax error, unexpected 'foreach' same thing with while loops
How can i create Table with column names i have in an array. And How can i set each column data type unique (INT,VARCHAR,..)