ruben |
|
---|---|
is there a dutch language already? or can i use my dutch seditio language
here a script to convert your databse to UTF8 <html> <head> <title>Convert MySQL Database to UTF-8</title> </head> <body> <?php // Fill in your configuration below $db_server = 'localhost'; $db_user = ''; $db_password = ''; $db_name = ''; // Do not change anything below this set_time_limit(0); $connection = mysql_connect($db_server, $db_user, $db_password) or die( mysql_error() ); $db = mysql_select_db($db_name) or die( mysql_error() ); $sql = 'SHOW TABLES'; if ( !($result = mysql_query($sql)) ) { print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n"; } // Loop through all tables in this database while ( $row = mysql_fetch_row($result) ) { $table = mysql_real_escape_string($row[0]); $sql2 = "ALTER TABLE $table DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"; if ( !($result2 = mysql_query($sql2)) ) { print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n"; break; } print "$table changed to UTF-8 successfully.<br>\n"; // Now loop through all the fields within this table $sql3 = "SHOW COLUMNS FROM $table"; if ( !($result3 = mysql_query($sql3)) ) { print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n"; break; } while ( $row3 = mysql_fetch_row($result3) ) { $field_name = $row3[0]; $field_type = $row3[1]; // Change text based fields $skipped_field_types = array('char', 'text', 'blob', 'enum', 'set'); foreach ( $skipped_field_types as $type ) { if ( strpos($field_type, $type) !== false ) { $sql4 = "ALTER TABLE $table CHANGE `$field_name` `$field_name` $field_type CHARACTER SET utf8 COLLATE utf8_bin"; if ( !($result4 = mysql_query($sql4)) ) { print '<span style="color: red;">SQL Error: <br>' . mysql_error() . "</span>\n"; break 3; } print "---- $field_name changed to UTF-8 successfully.<br>\n"; } } } print "<hr>\n"; } mysql_close($connection); ?> </body> </html> |