1
You can change all fields in my table to VARCHAR
? I have a table with plenty of fields and I wanted all fields to be automatically changed to type VARCHAR
1
You can change all fields in my table to VARCHAR
? I have a table with plenty of fields and I wanted all fields to be automatically changed to type VARCHAR
1
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!
Browser other questions tagged mysql
You are not signed in. Login or sign up in order to post.
Thanks for the solution =)
– David Concha
Sorry, there was a confusing...the script I made changes the tables......
– Dunga Cardoso
Okay, I corrected and made some improvements....
– Dunga Cardoso