Shows how you can alter all of the tables in a database (since sometimes theres hundreds of tables).
<?php /* your connection goes here, example: mysql_connect("localhost","root","***"); mysql_select_db("db1"); */ // convert code $res = mysql_query("SHOW TABLES"); while ($row = mysql_fetch_array($res)) { foreach ($row as $key => $table) { mysql_query("ALTER TABLE " . $table . " CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci"); echo $key . " - " . $table . " - CONVERTED<br />"; } } ?>
Change the 'ALTER' SQL syntax to whatever specific operation you need to perform on your database.
Comments
Add your comment