$que=mysql_query("select col_name from tbl_column_selected") or
die(mysql_error());
while(list($row_info) = mysql_fetch_array($que)) {
$data_arr[] = $row_info;
}
for($i=0; $i < count($data_arr); $i++) {
$col = $data_arr[$i];
mysqli_query($con,"ALTER TABLE tbl_display_selected_column ADD ".$col."
CHAR(50)");
}
for($j=0; $j<count($data_arr); $j++) {
$res = $data_arr[$j];
mysqli_query($con,"ALTER TABLE tbl_display_selected_column DROP ".$res."");
}
I can add columns to the table but i cannot drop the columns created. I have checked the columns are empty but still cannot drop. please help with the code.