<?php
$pre = run_query("SELECT * FROM " . $config["table_prefix"] . "fields WHERE `type_field`=4");
while ($row = mysqli_fetch_assoc($pre)) {
    $field['list_values'] = explode("\r\n", $row['type_value']);
    if (!$field['list_values']) {
        $field['list_values'] = array();
    }
    $max_list_size = 0;
    foreach ($field['list_values'] as $k => $v) {
        if (!$v) {
            unset($field['list_values'][$k]);
        }
        if ($max_list_size < strlen($v)) {
            $max_list_size = strlen($v);
        }
    }
    $sqlQ = "ALTER TABLE " . $config["table_prefix"] . "data" . $row['table_id'] . " CHANGE f" . $row['id'] . " f" . $row['id'] . " VARCHAR(" . $max_list_size . ") CHARACTER SET utf8 COLLATE utf8_general_ci";
    run_query($sqlQ);


}
?>