예제 #1
0
function AddData($conn)
{
    global $x_cvid, $user;
    $sFilter = ewSqlKeyWhere;
    // Check for duplicate key
    $bCheckKey = true;
    if (@$x_cvid == "" || is_null(@$x_cvid)) {
        $bCheckKey = false;
    } else {
        $sFilter = str_replace("@cvid", AdjustSql($x_cvid), $sFilter);
        // Replace key value
    }
    if ($bCheckKey) {
        $sSqlChk = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
        $rsChk = phpmkr_query($sSqlChk, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSqlChk);
        if (phpmkr_num_rows($rsChk) > 0) {
            //$_SESSION[ewSessionMessage] = "Duplicate value for primary key";
            phpmkr_free_result($rsChk);
            return false;
        }
        phpmkr_free_result($rsChk);
    }
    $EW_MaxFileSize = @$_POST["EW_Max_File_Size"];
    // Check the file size
    if (!empty($_FILES["x_picture"]["size"])) {
        if (!empty($EW_MaxFileSize) && $_FILES["x_picture"]["size"] > $EW_MaxFileSize) {
            die(str_replace("%s", $EW_MaxFileSize, "Max. file size (%s bytes) exceeded."));
        }
    }
    $fn_x_picture = $_FILES["x_picture"]["name"];
    // Check the file type
    if (!empty($fn_x_picture)) {
        if (!ewUploadAllowedFileExt($fn_x_picture)) {
            die("File type is not allowed.");
        }
    }
    $ct_x_picture = @$_POST["x_picture"];
    $x_picture = @$_POST["x_picture"];
    $wd_x_picture = @$_POST["wd_x_picture"];
    $ht_x_picture = @$_POST["ht_x_picture"];
    $a_x_picture = @$_POST["a_x_picture"];
    // Field onlineuser_onlineuserid
    $fieldList["`onlineuser_onlineuserid`"] = $user->onlineuserId;
    // Field picture
    if (is_uploaded_file($_FILES["x_picture"]["tmp_name"])) {
        $sTmpFolder = ewUploadPathEx(true, EW_UploadDestPath);
        $theName = ewUploadFileNameEx($sTmpFolder, $_FILES["x_picture"]["name"]);
        $destfile = $sTmpFolder . $theName;
        if (!move_uploaded_file($_FILES["x_picture"]["tmp_name"], $destfile)) {
            // Move file to destination path
            die("" . $destfile);
        }
        @chmod($destfile, defined(EW_UploadedFileMode) ? EW_UploadedFileMode : 0666);
        // File name
        $theName = !get_magic_quotes_gpc() ? addslashes($theName) : $theName;
        $fieldList["`picture`"] = " '" . $theName . "'";
        @unlink($_FILES["x_picture"]["tmp_name"]);
    }
    // Field first_name
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_first_name"]) : $GLOBALS["x_first_name"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`first_name`"] = $theValue;
    // Field mid_name
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mid_name"]) : $GLOBALS["x_mid_name"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`mid_name`"] = $theValue;
    // Field last_name
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_last_name"]) : $GLOBALS["x_last_name"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`last_name`"] = $theValue;
    // Field age
    $theValue = $GLOBALS["x_age"] != "" ? intval($GLOBALS["x_age"]) : "NULL";
    $fieldList["`age`"] = $theValue;
    // Field sex
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_sex"]) : $GLOBALS["x_sex"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`sex`"] = $theValue;
    // Field nationality
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_nationality"]) : $GLOBALS["x_nationality"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`nationality`"] = $theValue;
    // Field is_legal
    $theValue = $GLOBALS["x_is_legal"] != "" ? intval($GLOBALS["x_is_legal"]) : "NULL";
    $fieldList["`is_legal`"] = $theValue;
    // Field years_of_residence
    $theValue = $GLOBALS["x_years_of_residence"] != "" ? intval($GLOBALS["x_years_of_residence"]) : "NULL";
    $fieldList["`years_of_residence`"] = $theValue;
    // Field address_1
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_1"]) : $GLOBALS["x_address_1"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`address_1`"] = $theValue;
    // Field address_2
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_2"]) : $GLOBALS["x_address_2"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`address_2`"] = $theValue;
    // Field address_3
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_3"]) : $GLOBALS["x_address_3"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`address_3`"] = $theValue;
    // Field postcode
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_postcode"]) : $GLOBALS["x_postcode"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`postcode`"] = $theValue;
    // Field email
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_email"]) : $GLOBALS["x_email"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`email`"] = $theValue;
    // Field mobile
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mobile"]) : $GLOBALS["x_mobile"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`mobile`"] = $theValue;
    // Field tel
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tel"]) : $GLOBALS["x_tel"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`tel`"] = $theValue;
    // Field employer
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employer"]) : $GLOBALS["x_employer"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`employer`"] = $theValue;
    // Field uk_license
    $theValue = $GLOBALS["x_uk_license"] != "" ? intval($GLOBALS["x_uk_license"]) : "NULL";
    $fieldList["`uk_license`"] = $theValue;
    // Field european_license
    $theValue = $GLOBALS["x_european_license"] != "" ? intval($GLOBALS["x_european_license"]) : "NULL";
    $fieldList["`european_license`"] = $theValue;
    // Field license_points
    $theValue = $GLOBALS["x_license_points"] != "" ? intval($GLOBALS["x_license_points"]) : "NULL";
    $fieldList["`license_points`"] = $theValue;
    // Field marital_status
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_marital_status"]) : $GLOBALS["x_marital_status"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`marital_status`"] = $theValue;
    // Field has_dependent
    $theValue = $GLOBALS["x_has_dependent"] != "" ? intval($GLOBALS["x_has_dependent"]) : "NULL";
    $fieldList["`has_dependent`"] = $theValue;
    // Field can_relocate
    $theValue = $GLOBALS["x_can_relocate"] != "" ? intval($GLOBALS["x_can_relocate"]) : "NULL";
    $fieldList["`can_relocate`"] = $theValue;
    // Field can_travel
    $theValue = $GLOBALS["x_can_travel"] != "" ? intval($GLOBALS["x_can_travel"]) : "NULL";
    $fieldList["`can_travel`"] = $theValue;
    // Field employement_status
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employement_status"]) : $GLOBALS["x_employement_status"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`employement_status`"] = $theValue;
    // Field work_location
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_work_location"]) : $GLOBALS["x_work_location"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`work_location`"] = $theValue;
    // Field position_held
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_position_held"]) : $GLOBALS["x_position_held"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`position_held`"] = $theValue;
    // Field salary
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary"]) : $GLOBALS["x_salary"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`salary`"] = $theValue;
    // Field bonus
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_bonus"]) : $GLOBALS["x_bonus"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`bonus`"] = $theValue;
    // Field ambitions
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_ambitions"]) : $GLOBALS["x_ambitions"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`ambitions`"] = $theValue;
    // Field salary_expectation_start
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_start"]) : $GLOBALS["x_salary_expectation_start"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`salary_expectation_start`"] = $theValue;
    // Field salary_expectation_one
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_one"]) : $GLOBALS["x_salary_expectation_one"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`salary_expectation_one`"] = $theValue;
    // Field salary_expectation_two
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_two"]) : $GLOBALS["x_salary_expectation_two"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`salary_expectation_two`"] = $theValue;
    // Field achievement_sales
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_sales"]) : $GLOBALS["x_achievement_sales"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`achievement_sales`"] = $theValue;
    // Field achievement_food
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_food"]) : $GLOBALS["x_achievement_food"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`achievement_food`"] = $theValue;
    // Field achievement_labour
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_labour"]) : $GLOBALS["x_achievement_labour"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`achievement_labour`"] = $theValue;
    // Field interests
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_interests"]) : $GLOBALS["x_interests"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`interests`"] = $theValue;
    // Field qualifications
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_qualifications"]) : $GLOBALS["x_qualifications"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`qualifications`"] = $theValue;
    // Field tell_us
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tell_us"]) : $GLOBALS["x_tell_us"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`tell_us`"] = $theValue;
    // Field notice
    $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_notice"]) : $GLOBALS["x_notice"];
    $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
    $fieldList["`notice`"] = $theValue;
    // Inserting event
    if (Recordset_Inserting($fieldList)) {
        // Insert
        $sSql = "INSERT INTO `cv` (";
        $sSql .= implode(",", array_keys($fieldList));
        $sSql .= ") VALUES (";
        $sSql .= implode(",", array_values($fieldList));
        $sSql .= ")";
        phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
        $fieldList["`cvid`"] = phpmkr_insert_id($conn);
        $result = phpmkr_affected_rows($conn) > 0;
        // Inserted event
        if ($result) {
            Recordset_Inserted($fieldList);
        }
    } else {
        $result = false;
    }
    return $result;
}
예제 #2
0
function EditData($conn)
{
    global $x_cvid, $user;
    $sFilter = ewSqlKeyWhere;
    if (!is_numeric($x_cvid)) {
        return false;
    }
    $sTmp = get_magic_quotes_gpc() ? stripslashes($x_cvid) : $x_cvid;
    $sFilter = str_replace("@cvid", AdjustSql($sTmp), $sFilter);
    // Replace key value
    $sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
    $rs = phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    // Get old recordset
    $oldrs = phpmkr_fetch_array($rs);
    if (phpmkr_num_rows($rs) == 0) {
        return false;
        // Update Failed
    } else {
        // Check file size
        $EW_MaxFileSize = @$_POST["EW_Max_File_Size"];
        // Check the file size
        if (!empty($_FILES["x_picture"]["size"])) {
            if (!empty($EW_MaxFileSize) && $_FILES["x_picture"]["size"] > $EW_MaxFileSize) {
                die(str_replace("%s", $EW_MaxFileSize, "Max. file size (%s bytes) exceeded."));
            }
        }
        $fn_x_picture = @$_FILES["x_picture"]["name"];
        // Check the file type
        if (!empty($fn_x_picture)) {
            if (!ewUploadAllowedFileExt($fn_x_picture)) {
                die("File type is not allowed.");
            }
        }
        $ct_x_picture = @$_POST["x_picture"];
        $x_picture = @$_POST["x_picture"];
        $wd_x_picture = @$_POST["wd_x_picture"];
        $ht_x_picture = @$_POST["ht_x_picture"];
        $a_x_picture = @$_POST["a_x_picture"];
        $x_first_name = @$_POST["x_first_name"];
        $x_mid_name = @$_POST["x_mid_name"];
        $x_last_name = @$_POST["x_last_name"];
        $x_age = @$_POST["x_age"];
        $x_sex = @$_POST["x_sex"];
        $x_nationality = @$_POST["x_nationality"];
        $x_is_legal = @$_POST["x_is_legal"];
        $x_years_of_residence = @$_POST["x_years_of_residence"];
        $x_address_1 = @$_POST["x_address_1"];
        $x_address_2 = @$_POST["x_address_2"];
        $x_address_3 = @$_POST["x_address_3"];
        $x_postcode = @$_POST["x_postcode"];
        $x_email = @$_POST["x_email"];
        $x_mobile = @$_POST["x_mobile"];
        $x_tel = @$_POST["x_tel"];
        $x_employer = @$_POST["x_employer"];
        $x_uk_license = @$_POST["x_uk_license"];
        $x_european_license = @$_POST["x_european_license"];
        $x_license_points = @$_POST["x_license_points"];
        $x_marital_status = @$_POST["x_marital_status"];
        $x_has_dependent = @$_POST["x_has_dependent"];
        $x_can_relocate = @$_POST["x_can_relocate"];
        $x_can_travel = @$_POST["x_can_travel"];
        $x_employement_status = @$_POST["x_employement_status"];
        $x_work_location = @$_POST["x_work_location"];
        $x_position_held = @$_POST["x_position_held"];
        $x_salary = @$_POST["x_salary"];
        $x_bonus = @$_POST["x_bonus"];
        $x_ambitions = @$_POST["x_ambitions"];
        $x_salary_expectation_start = @$_POST["x_salary_expectation_start"];
        $x_salary_expectation_one = @$_POST["x_salary_expectation_one"];
        $x_salary_expectation_two = @$_POST["x_salary_expectation_two"];
        $x_achievement_sales = @$_POST["x_achievement_sales"];
        $x_achievement_food = @$_POST["x_achievement_food"];
        $x_achievement_labour = @$_POST["x_achievement_labour"];
        $x_interests = @$_POST["x_interests"];
        $x_qualifications = @$_POST["x_qualifications"];
        $x_tell_us = @$_POST["x_tell_us"];
        $x_notice = @$_POST["x_notice"];
        $x_dt_created = @$_POST["x_dt_created"];
        $x_cv_status = @$_POST["x_cv_status"];
        // Field onlineuser_onlineuserid
        $fieldList["`onlineuser_onlineuserid`"] = $user->onlineuserId;
        if ($a_x_picture == "2") {
            // Remove
            $fieldList["`picture`"] = "NULL";
            $ox_picture = $oldrs["picture"];
            $sTmpFolder = ewUploadPathEx(True, EW_UploadDestPath);
            if ($ox_picture != "") {
                @unlink($sTmpFolder . $ox_picture);
            }
        } else {
            if ($a_x_picture == "3") {
                // Update
                if (is_uploaded_file($_FILES["x_picture"]["tmp_name"])) {
                    $sTmpFolder = ewUploadPathEx(true, EW_UploadDestPath);
                    $ox_picture = $oldrs["picture"];
                    if ($ox_picture != "") {
                        @unlink($sTmpFolder . $ox_picture);
                    }
                    $theName = ewUploadFileNameEx($sTmpFolder, $_FILES["x_picture"]["name"]);
                    $destfile = $sTmpFolder . $theName;
                    if (!move_uploaded_file($_FILES["x_picture"]["tmp_name"], $destfile)) {
                        // Move file to destination path
                        die("" . $destfile);
                    }
                    @chmod($destfile, defined(EW_UploadedFileMode) ? EW_UploadedFileMode : 0666);
                    // File name
                    $theName = !get_magic_quotes_gpc() ? addslashes($theName) : $theName;
                    $fieldList["`picture`"] = " '" . $theName . "'";
                    @unlink($_FILES["x_picture"]["tmp_name"]);
                }
            }
        }
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_first_name"]) : $GLOBALS["x_first_name"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`first_name`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mid_name"]) : $GLOBALS["x_mid_name"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`mid_name`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_last_name"]) : $GLOBALS["x_last_name"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`last_name`"] = $theValue;
        $theValue = $GLOBALS["x_age"] != "" ? intval($GLOBALS["x_age"]) : "NULL";
        $fieldList["`age`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_sex"]) : $GLOBALS["x_sex"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`sex`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_nationality"]) : $GLOBALS["x_nationality"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`nationality`"] = $theValue;
        $theValue = $GLOBALS["x_is_legal"] != "" ? intval($GLOBALS["x_is_legal"]) : "NULL";
        $fieldList["`is_legal`"] = $theValue;
        $theValue = $GLOBALS["x_years_of_residence"] != "" ? intval($GLOBALS["x_years_of_residence"]) : "NULL";
        $fieldList["`years_of_residence`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_1"]) : $GLOBALS["x_address_1"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`address_1`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_2"]) : $GLOBALS["x_address_2"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`address_2`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_3"]) : $GLOBALS["x_address_3"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`address_3`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_postcode"]) : $GLOBALS["x_postcode"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`postcode`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_email"]) : $GLOBALS["x_email"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`email`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mobile"]) : $GLOBALS["x_mobile"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`mobile`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tel"]) : $GLOBALS["x_tel"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`tel`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employer"]) : $GLOBALS["x_employer"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`employer`"] = $theValue;
        $theValue = $GLOBALS["x_uk_license"] != "" ? intval($GLOBALS["x_uk_license"]) : "NULL";
        $fieldList["`uk_license`"] = $theValue;
        $theValue = $GLOBALS["x_european_license"] != "" ? intval($GLOBALS["x_european_license"]) : "NULL";
        $fieldList["`european_license`"] = $theValue;
        $theValue = $GLOBALS["x_license_points"] != "" ? intval($GLOBALS["x_license_points"]) : "NULL";
        $fieldList["`license_points`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_marital_status"]) : $GLOBALS["x_marital_status"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`marital_status`"] = $theValue;
        $theValue = $GLOBALS["x_has_dependent"] != "" ? intval($GLOBALS["x_has_dependent"]) : "NULL";
        $fieldList["`has_dependent`"] = $theValue;
        $theValue = $GLOBALS["x_can_relocate"] != "" ? intval($GLOBALS["x_can_relocate"]) : "NULL";
        $fieldList["`can_relocate`"] = $theValue;
        $theValue = $GLOBALS["x_can_travel"] != "" ? intval($GLOBALS["x_can_travel"]) : "NULL";
        $fieldList["`can_travel`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employement_status"]) : $GLOBALS["x_employement_status"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`employement_status`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_work_location"]) : $GLOBALS["x_work_location"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`work_location`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_position_held"]) : $GLOBALS["x_position_held"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`position_held`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary"]) : $GLOBALS["x_salary"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`salary`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_bonus"]) : $GLOBALS["x_bonus"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`bonus`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_ambitions"]) : $GLOBALS["x_ambitions"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`ambitions`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_start"]) : $GLOBALS["x_salary_expectation_start"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`salary_expectation_start`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_one"]) : $GLOBALS["x_salary_expectation_one"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`salary_expectation_one`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_two"]) : $GLOBALS["x_salary_expectation_two"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`salary_expectation_two`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_sales"]) : $GLOBALS["x_achievement_sales"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`achievement_sales`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_food"]) : $GLOBALS["x_achievement_food"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`achievement_food`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_labour"]) : $GLOBALS["x_achievement_labour"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`achievement_labour`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_interests"]) : $GLOBALS["x_interests"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`interests`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_qualifications"]) : $GLOBALS["x_qualifications"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`qualifications`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tell_us"]) : $GLOBALS["x_tell_us"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`tell_us`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_notice"]) : $GLOBALS["x_notice"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`notice`"] = $theValue;
        $theValue = $GLOBALS["x_dt_created"] != "" ? " '" . ConvertDateToMysqlFormat($GLOBALS["x_dt_created"]) . "'" : "'" . date("D, d M Y H:i:s") . "'";
        $fieldList["`dt_created`"] = $theValue;
        $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_cv_status"]) : $GLOBALS["x_cv_status"];
        $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL";
        $fieldList["`cv_status`"] = $theValue;
        // Updating event
        if (Recordset_Updating($fieldList, $oldrs)) {
            // Update
            $sSql = "UPDATE `cv` SET ";
            foreach ($fieldList as $key => $temp) {
                $sSql .= "{$key} = {$temp}, ";
            }
            if (substr($sSql, -2) == ", ") {
                $sSql = substr($sSql, 0, strlen($sSql) - 2);
            }
            $sSql .= " WHERE " . $sFilter;
            phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
            $result = phpmkr_affected_rows($conn) >= 0;
            // Updated event
            if ($result) {
                Recordset_Updated($fieldList, $oldrs);
            }
        } else {
            $result = false;
            // Update Failed
        }
    }
    return $result;
}