Example #1
0
/**
 * Prevent user from aborting script
 */
$oldAbort = ignore_user_abort(true);
/**
 * Insert new connection problem
 */
$connQ = new Query_Connection();
$recordQ = new Query_Page_Record();
$n = count($_POST["check"]);
for ($i = 0; $i < $n; $i++) {
    if ($idProblem == $_POST["check"][$i]) {
        continue;
        // a problem can't be connection of itself
    }
    $connQ->captureError(true);
    $connQ->insert($idProblem, $_POST["check"][$i]);
    if ($connQ->isError()) {
        if ($connQ->getDbErrno() == 1062) {
            $connQ->clearErrors();
        } else {
            $connQ->close();
            Error::query($connQ);
        }
    } else {
        /**
         * Record log process
         */
        $recordQ->log("Query_Connection", "INSERT", array($idProblem, $_POST["check"][$i]));
    }
}