PHP – Changing MySQL tables on the fly – bad idea?

I recently saw a comment on StackOverflow, which says it's a bad idea to change tables on the fly.

In my case I have one json File containing information about some "products". One of these information tells other programs which column in a data table refers to this product. This id is not user-defined.

I have some php Features for adding / deleting products json File, but during these functions, a column in a table must either be added or removed.

$sql = 'ALTER TABLE products ADD '.$id.' VARCHAR(11)';
$stmt = $mysql->prepare($sql);
$execute = $stmt->execute();
if($execute!==false){
    $build = ("name"=>$product_name, "release"=>$release_date, "details"=>$details, "id"=>$id);
    array_push($products("products"),$build);
    $products = json_encode($products,JSON_PRETTY_PRINT);
    $file = fopen("./crm.json","w+");
    fwrite($file,$products);
    fclose($file);  
}else{
    //error message
}   

Could someone explain why this can be a bad idea?