function createMonitorEvent($event_date, $event_type, $event_sub_type, $event_description, $event_client_name, $event_tags)
{
    global $mysqlCon;
    $event_client_name = findClientNameFromParams($event_date, $event_type, $event_sub_type, $event_description, $event_client_name, $event_tags);
    $query = "INSERT INTO monitoring_event (event_date, event_type, event_sub_type, event_description, client_name, tags) VALUES (";
    $query .= "'" . escapeString(date('Y-m-d H:i:s')) . "'";
    $query .= ",'" . escapeString($event_type) . "'";
    $query .= ",'" . escapeString($event_sub_type) . "'";
    $query .= ",'" . escapeString($event_description) . "'";
    $query .= ",'" . escapeString($event_client_name) . "'";
    $query .= ",'" . escapeString($event_tags) . "'";
    $query .= ' )';
    mysqli_query($mysqlCon, $query);
    $textMessage = $event_type . ": " . $event_description;
    sendToSlack($textMessage, $event_type);
}
<?php

require_once dirname(__FILE__) . '/init.php';
$query = "SELECT * from monitoring_event ORDER BY event_date ASC";
$cnt = null;
$res = mysqli_query($mysqlCon, $query);
while ($t = mysqli_fetch_assoc($res)) {
    //var_dump($t);
    $event_id = $t['id'];
    $event_date = $t['event_date'];
    $event_type = $t['event_type'];
    $event_sub_type = $t['event_sub_type'];
    $event_description = $t['event_description'];
    $client_name = $t['client_name'];
    $event_tags = $t['tags'];
    $new_client_name = findClientNameFromParams($event_date, $event_type, $event_sub_type, $event_description, $client_name, $event_tags);
    if ($new_client_name != $client_name) {
        $query = "UPDATE monitoring_event SET client_name=";
        $query .= "'" . escapeString($new_client_name) . "'";
        $query .= " WHERE id=" . $event_id;
        echo "\n" . $query;
        mysqli_query($mysqlCon, $query);
    }
}
echo "\nOK\n";