Can you change all fields in my table to VARCHAR
? I have a table with a lot of fields and I wanted all fields to be automatically changed to type VARCHAR
Can you change all fields in my table to VARCHAR
? I have a table with a lot of fields and I wanted all fields to be automatically changed to type VARCHAR
Make a script in PHP
$tabela = "nomedatabelaparamodificar"
$sql = mysqli_query($conn, "SHOW COLUMNS FROM $tabela");
while ($lista = mysqli_fetch_array($sql)){
$array[] = $lista[0];
}
foreach ($array as $valor){
mysql_query($conn, "ALTER TABLE $tabela MODIFY $valor VARCHAR(50)");
}
Try this!