userdata['acclevel'] < 80) die ('Access denied!'); ?> title; ?>
0) {
echo 'Run these statements against your MySql database
';
echo "ALTER DATABASE `".DB_NAME."` DEFAULT CHARACTER SET $character_set COLLATE $convert_to;
";
$rs_tables = $db->query('SHOW TABLES') or die(mysql_error());
while ($row_tables = $db->fetch_row($rs_tables))
{
$table = mysql_real_escape_string($row_tables[0]);
echo "ALTER TABLE `$table` DEFAULT CHARACTER SET $character_set;
";
$rs = $db->query("SHOW FULL FIELDS FROM `$table` WHERE collation is not null AND collation <> 'utf8_general_ci'") or die(mysql_error());
while ($row=mysql_fetch_assoc($rs))
{
if ($row['Collation'] == '')
continue;
if ( strtolower($row['Null']) == 'yes' )
$nullable = ' NULL ';
else
$nullable = ' NOT NULL';
if ( $row['Default'] === NULL && $nullable = ' NOT NULL ')
$default = " DEFAULT ''";
else if ( $row['Default'] === NULL )
$default = ' DEFAULT NULL';
else if ($row['Default']!='')
$default = " DEFAULT '".mysql_real_escape_string($row['Default'])."'";
else
$default = '';
$field = mysql_real_escape_string($row['Field']);
echo "ALTER TABLE `$table` CHANGE `$field` `$field` $row[Type] CHARACTER SET $character_set COLLATE $convert_to $nullable $default;
";
}
}
} else {
echo "Converting database, table, and row collations to utf8:
'; } } else { ?>