foreach ($unique_spellids as $key => $val) {
    if ($key > 0) {
        $sql_list .= $key . ",";
    }
}
$sql_list = substr($sql_list, 0, -1);
$unique_proc_spellids = "";
//$get_query = "select id from dbc_spell where id in ($sql_list) and (EffectApplyAuraName_1=42 or EffectApplyAuraName_2=42 or EffectApplyAuraName_3=42)";
$get_query = "select id from dbc_spell where id in ({$sql_list}) and (EffectApplyAuraName_1=4 or EffectApplyAuraName_2=4 or EffectApplyAuraName_3=4 or EffectApplyAuraName_1=42 or EffectApplyAuraName_2=42 or EffectApplyAuraName_3=42) and id>50000";
$get_res = mysql_query($get_query, $dbi) or die(" Q200611231501411 " . mysql_error($dbi) . "<br> {$get_query}");
while ($row = mysql_fetch_row($get_res)) {
    $unique_proc_spellids[$row[0]] = 1;
}
$as_sql_proclist = "";
foreach ($unique_proc_spellids as $key => $val) {
    if (have_hardcoded_fixes_for($key) == 0) {
        echo $key . "<br>";
        $as_sql_proclist .= $key . ",";
    }
}
$as_sql_proclist = substr($as_sql_proclist, 0, -1);
echo "select id,name,description from dbc_spell where id in ({$as_sql_proclist});<br>";
//omg strpos fails on large strings
function strfind($haystack, $needle)
{
    $needle = $needle . "";
    $search_letter = 0;
    $total_letters = strlen($needle);
    $stacklen = strlen($haystack);
    //echo "needle len = $total_letters, stack len = $stacklen, stack :  $haystack, needle : $needle <br>";
    for ($i = 0; $i < $stacklen; $i++) {
    }
    // new table does not have this item. Maybe it is a custom item.
    $needs_report = 0;
    $query2 = "#revert_to_old update {$table_1} set ";
    $query = "update {$table_1} set ";
    for ($i = 0; $i < $field_count; $i++) {
        if ($row[$i] != $row2[$i] && $field_names[$i] != "Targets" && $field_names[$i] != "ManaCostPercentage" && $field_names[$i] != "ManaCostPercentage" && $field_names[$i] != "ManaCostPercentage" && $field_names[$i] != "RequiredShapeShift") {
            $query2 .= $field_names[$i] . "='" . mysql_escape_string($row[$i]) . "',";
            $query .= $field_names[$i] . "='" . mysql_escape_string($row2[$i]) . "',";
            $needs_report = 1;
        }
    }
    if ($needs_report == 1) {
        $query2 = substr($query2, 0, -1) . " where entry={$row[0]};";
        $query = substr($query, 0, -1) . " where entry={$row[0]};";
        if (have_hardcoded_fixes_for($row[0])) {
            $change_counter++;
            echo "{$change_counter})Spell {$row[0]} needs to be reviewed : " . $row[$field_name_to_index['Name']] . " ###  " . $row[$field_name_to_index['Description']] . "<br>";
            echo "<b>" . $query . "</b><br>";
            echo $query2 . "<br>";
            $review_list_names[$row[$field_name_to_index['Name']]] = 1;
        }
    }
}
echo "#########################################################################<br>";
foreach ($review_list_names as $key => $value) {
    echo "# " . $key . "<br>";
}
echo "#########################################################################<br>";
/*
//to insert newly got items