当前位置: 首页>>代码示例>>PHP>>正文


PHP F_db_insert_id函数代码示例

本文整理汇总了PHP中F_db_insert_id函数的典型用法代码示例。如果您正苦于以下问题:PHP F_db_insert_id函数的具体用法?PHP F_db_insert_id怎么用?PHP F_db_insert_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了F_db_insert_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: endElementHandler

    /**
     * Sets the end element handler function for the XML parser parser.end_element_handler.
     * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
     * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
     * @private
     */
    private function endElementHandler($parser, $name)
    {
        global $l, $db;
        require_once '../config/tce_config.php';
        require_once 'tce_functions_user_select.php';
        switch (strtolower($name)) {
            case 'name':
            case 'password':
            case 'email':
            case 'regdate':
            case 'ip':
            case 'firstname':
            case 'lastname':
            case 'birthdate':
            case 'birthplace':
            case 'regnumber':
            case 'ssn':
            case 'level':
            case 'verifycode':
                $this->current_data = F_escape_sql(F_xml_to_text($this->current_data));
                $this->user_data[$this->current_element] = $this->current_data;
                $this->current_element = '';
                $this->current_data = '';
                break;
            case 'group':
                $group_name = F_escape_sql(F_xml_to_text($this->current_data));
                // check if group already exist
                $sql = 'SELECT group_id
					FROM ' . K_TABLE_GROUPS . '
					WHERE group_name=\'' . $group_name . '\'
					LIMIT 1';
                if ($r = F_db_query($sql, $db)) {
                    if ($m = F_db_fetch_array($r)) {
                        // the group has been already added
                        $this->group_data[] = $m['group_id'];
                    } else {
                        // add new group
                        $sqli = 'INSERT INTO ' . K_TABLE_GROUPS . ' (
							group_name
							) VALUES (
							\'' . $group_name . '\'
							)';
                        if (!($ri = F_db_query($sqli, $db))) {
                            F_display_db_error(false);
                        } else {
                            $this->group_data[] = F_db_insert_id($db, K_TABLE_GROUPS, 'group_id');
                        }
                    }
                } else {
                    F_display_db_error();
                }
                break;
            case 'user':
                // insert users
                if (!empty($this->user_data['user_name'])) {
                    if (empty($this->user_data['user_regdate'])) {
                        $this->user_data['user_regdate'] = date(K_TIMESTAMP_FORMAT);
                    }
                    if (empty($this->user_data['user_ip'])) {
                        $this->user_data['user_ip'] = getNormalizedIP($_SERVER['REMOTE_ADDR']);
                    }
                    if (!isset($this->user_data['user_level']) or strlen($this->user_data['user_level']) == 0) {
                        $this->user_data['user_level'] = 1;
                    }
                    if ($_SESSION['session_user_level'] < K_AUTH_ADMINISTRATOR) {
                        // you cannot edit a user with a level equal or higher than yours
                        $this->user_data['user_level'] = min(max(0, $_SESSION['session_user_level'] - 1), $this->user_data['user_level']);
                        // non-administrator can access only to his/her groups
                        if (empty($this->group_data)) {
                            break;
                        }
                        $common_groups = array_intersect(F_get_user_groups($_SESSION['session_user_id']), $this->group_data);
                        if (empty($common_groups)) {
                            break;
                        }
                    }
                    // check if user already exist
                    $sql = 'SELECT user_id,user_level
						FROM ' . K_TABLE_USERS . '
						WHERE user_name=\'' . $this->user_data['user_name'] . '\'
							OR user_regnumber=\'' . $this->user_data['user_regnumber'] . '\'
							OR user_ssn=\'' . $this->user_data['user_ssn'] . '\'
						LIMIT 1';
                    if ($r = F_db_query($sql, $db)) {
                        if ($m = F_db_fetch_array($r)) {
                            // the user has been already added
                            $user_id = $m['user_id'];
                            if ($_SESSION['session_user_level'] >= K_AUTH_ADMINISTRATOR or $_SESSION['session_user_level'] > $m['user_level']) {
                                //update user data
                                $sqlu = 'UPDATE ' . K_TABLE_USERS . ' SET
									user_regdate=\'' . $this->user_data['user_regdate'] . '\',
									user_ip=\'' . $this->user_data['user_ip'] . '\',
									user_name=\'' . $this->user_data['user_name'] . '\',
									user_email=' . F_empty_to_null($this->user_data['user_email']) . ',';
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zjxt-svn-to-git,代码行数:101,代码来源:tce_import_xml_users.php

示例2: F_TSVQuestionImporter

/**
 * Import questions from TSV file (tab delimited text).
 * The format of TSV is the same obtained by exporting data from TCExam interface.
 * @param $tsvfile (string) TSV (tab delimited text) file name
 * @return boolean TRUE in case of success, FALSE otherwise
 */
function F_TSVQuestionImporter($tsvfile)
{
    global $l, $db;
    require_once '../config/tce_config.php';
    require_once '../../shared/code/tce_functions_auth_sql.php';
    $qtype = array('S' => 1, 'M' => 2, 'T' => 3, 'O' => 4);
    // get file content as array
    $tsvrows = file($tsvfile, FILE_IGNORE_NEW_LINES);
    // array of TSV lines
    if ($tsvrows === FALSE) {
        return FALSE;
    }
    $current_module_id = 0;
    $current_subject_id = 0;
    $current_question_id = 0;
    $current_answer_id = 0;
    $questionhash = array();
    // for each row
    while (list($item, $rowdata) = each($tsvrows)) {
        // get user data into array
        $qdata = explode("\t", $rowdata);
        switch ($qdata[0]) {
            case 'M':
                // MODULE
                $current_module_id = 0;
                if (!isset($qdata[2]) or empty($qdata[2])) {
                    break;
                }
                $module_enabled = intval($qdata[1]);
                $module_name = F_escape_sql($db, F_tsv_to_text($qdata[2]), false);
                // check if this module already exist
                $sql = 'SELECT module_id
					FROM ' . K_TABLE_MODULES . '
					WHERE module_name=\'' . $module_name . '\'
					LIMIT 1';
                if ($r = F_db_query($sql, $db)) {
                    if ($m = F_db_fetch_array($r)) {
                        // get existing module ID
                        if (!F_isAuthorizedUser(K_TABLE_MODULES, 'module_id', $m['module_id'], 'module_user_id')) {
                            // unauthorized user
                            $current_module_id = 0;
                        } else {
                            $current_module_id = $m['module_id'];
                        }
                    } else {
                        // insert new module
                        $sql = 'INSERT INTO ' . K_TABLE_MODULES . ' (
							module_name,
							module_enabled,
							module_user_id
							) VALUES (
							\'' . $module_name . '\',
							\'' . $module_enabled . '\',
							\'' . $_SESSION['session_user_id'] . '\'
							)';
                        if (!($r = F_db_query($sql, $db))) {
                            F_display_db_error();
                        } else {
                            // get new module ID
                            $current_module_id = F_db_insert_id($db, K_TABLE_MODULES, 'module_id');
                        }
                    }
                } else {
                    F_display_db_error();
                }
                break;
            case 'S':
                // SUBJECT
                $current_subject_id = 0;
                if ($current_module_id == 0) {
                    return;
                }
                if (!isset($qdata[2]) or empty($qdata[2])) {
                    break;
                }
                $subject_enabled = intval($qdata[1]);
                $subject_name = F_escape_sql($db, F_tsv_to_text($qdata[2]), false);
                $subject_description = '';
                if (isset($qdata[3])) {
                    $subject_description = F_empty_to_null(F_tsv_to_text($qdata[3]));
                }
                // check if this subject already exist
                $sql = 'SELECT subject_id
					FROM ' . K_TABLE_SUBJECTS . '
					WHERE subject_name=\'' . $subject_name . '\'
						AND subject_module_id=' . $current_module_id . '
					LIMIT 1';
                if ($r = F_db_query($sql, $db)) {
                    if ($m = F_db_fetch_array($r)) {
                        // get existing subject ID
                        $current_subject_id = $m['subject_id'];
                    } else {
                        // insert new subject
                        $sql = 'INSERT INTO ' . K_TABLE_SUBJECTS . ' (
//.........这里部分代码省略.........
开发者ID:dungvu,项目名称:tcexam,代码行数:101,代码来源:tce_import_questions.php

示例3: VALUES

							tsubset_test_id,
							tsubset_type,
							tsubset_difficulty,
							tsubset_quantity,
							tsubset_answers
							) VALUES (
							\'' . $test_id . '\',
							\'' . $m['tsubset_type'] . '\',
							\'' . $m['tsubset_difficulty'] . '\',
							\'' . $m['tsubset_quantity'] . '\',
							\'' . $m['tsubset_answers'] . '\'
							)';
                        if (!($ru = F_db_query($sqlu, $db))) {
                            F_display_db_error();
                        } else {
                            $tsubset_id = F_db_insert_id($db, K_TABLE_TEST_SUBJSET, 'tsubset_id');
                            $sqls = 'SELECT *
								FROM ' . K_TABLE_SUBJECT_SET . '
								WHERE subjset_tsubset_id=\'' . $m['tsubset_id'] . '\'';
                            if ($rs = F_db_query($sqls, $db)) {
                                while ($ms = F_db_fetch_array($rs)) {
                                    $sqlp = 'INSERT INTO ' . K_TABLE_SUBJECT_SET . ' (
										subjset_tsubset_id,
										subjset_subject_id
										) VALUES (
										\'' . $tsubset_id . '\',
										\'' . $ms['subjset_subject_id'] . '\'
										)';
                                    if (!($rp = F_db_query($sqlp, $db))) {
                                        F_display_db_error();
                                    }
开发者ID:dungvu,项目名称:tcexam,代码行数:31,代码来源:tce_edit_test.php

示例4: VALUES

				subject_name,
				subject_description,
				subject_enabled,
				subject_user_id,
				subject_module_id
				) VALUES (
				\'' . F_escape_sql($db, $subject_name) . '\',
				' . F_empty_to_null($subject_description) . ',
				\'' . intval($subject_enabled) . '\',
				\'' . intval($_SESSION['session_user_id']) . '\',
				' . $subject_module_id . '
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $subject_id = F_db_insert_id($db, K_TABLE_SUBJECTS, 'subject_id');
            }
        }
        break;
    case 'clear':
        // Clear form fields
        $subject_name = '';
        $subject_description = '';
        $subject_enabled = true;
        break;
    default:
        break;
}
//end of switch
// select default module (if not specified)
if ($subject_module_id <= 0) {
开发者ID:dungvu,项目名称:tcexam,代码行数:31,代码来源:tce_edit_subject.php

示例5: F_empty_to_null

				' . F_empty_to_null($user_email) . ',
				\'' . F_escape_sql($db, $user_password) . '\',
				' . F_empty_to_null($user_regnumber) . ',
				' . F_empty_to_null($user_firstname) . ',
				' . F_empty_to_null($user_lastname) . ',
				' . F_empty_to_null($user_birthdate) . ',
				' . F_empty_to_null($user_birthplace) . ',
				' . F_empty_to_null($user_ssn) . ',
				\'' . $usrlevel . '\',
				\'' . $user_verifycode . '\',
				' . F_empty_to_null($user_otpkey) . '
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $user_id = F_db_insert_id($db, K_TABLE_USERS, 'user_id');
            }
            // add user's groups
            if (empty($user_groups)) {
                $user_groups = array(K_USRREG_GROUP);
            } elseif (!in_array(K_USRREG_GROUP, $user_groups)) {
                $user_groups[] = K_USRREG_GROUP;
            }
            foreach ($user_groups as $group_id) {
                $sql = 'INSERT INTO ' . K_TABLE_USERGROUP . ' (
					usrgrp_user_id,
					usrgrp_group_id
					) VALUES (
					\'' . $user_id . '\',
					\'' . $group_id . '\'
					)';
开发者ID:dungvu,项目名称:tcexam,代码行数:31,代码来源:tce_user_registration.php

示例6: F_escape_sql

				' . $question_subject_id . ',
				\'' . F_escape_sql($question_description) . '\',
				' . F_empty_to_null($question_explanation) . ',
				\'' . $question_type . '\',
				\'' . $question_difficulty . '\',
				\'' . $question_enabled . '\',
				' . F_zero_to_null($question_position) . ',
				\'' . $question_timer . '\',
				\'' . $question_fullscreen . '\',
				\'' . $question_inline_answers . '\',
				\'' . $question_auto_next . '\'
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $question_id = F_db_insert_id($db, K_TABLE_QUESTIONS, 'question_id');
            }
            $sql = 'COMMIT';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
                break;
            }
        }
        break;
    case 'clear':
        // Clear form fields
        $question_description = '';
        $question_explanation = '';
        $question_type = 1;
        $question_difficulty = 1;
        $question_enabled = true;
开发者ID:BGCX261,项目名称:zjxt-svn-to-git,代码行数:31,代码来源:tce_edit_question.php

示例7: F_print_error

                F_print_error('WARNING', $l['m_duplicate_name']);
                $formstatus = FALSE;
                F_stripslashes_formfields();
                break;
            }
            $sql = 'INSERT INTO ' . K_TABLE_TEMPLATES . ' (
				tmp_name,
				tmp_template
				) VALUES (
				\'' . F_escape_sql($tmp_name) . '\',
				\'' . F_escape_sql($tmp_template) . '\'
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $tmp_id = F_db_insert_id($db, K_TABLE_TEMPLATES, 'tmp_id');
            }
        }
        break;
    case 'clear':
        // Clear form fields
        $tmp_name = '';
        $tmp_template = '';
        break;
    default:
        break;
}
//end of switch
// --- Initialize variables
if ($formstatus) {
    if ($menu_mode != 'clear') {
开发者ID:jayadevn,项目名称:RackMap,代码行数:31,代码来源:tce_edit_templates.php

示例8: VALUES

				sts_description,
				sts_floor,
				sts_width,
				sts_height
				) VALUES (
				' . $dcn_id . ',
				\'' . F_escape_sql($sts_name) . '\',
				' . F_empty_to_null($sts_description) . ',
				' . $sts_floor . ',
				' . $sts_width . ',
				' . $sts_height . '
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $sts_id = F_db_insert_id($db, K_TABLE_SUITES, 'sts_id');
            }
            // add default permission for non administrators
            if ($userlevel < K_AUTH_ADMINISTRATOR and empty($perms)) {
                foreach ($user_groups as $grp) {
                    $perms[$grp] = 15;
                    // read + add + update + delete
                }
            }
            // insert groups permissions
            if (!empty($perms)) {
                foreach ($perms as $group_id => $pval) {
                    $sql = 'INSERT INTO ' . K_TABLE_SUITE_GROUPS . ' (
						stg_sts_id,
						stg_group_id,
						stg_permission
开发者ID:jayadevn,项目名称:RackMap,代码行数:31,代码来源:tce_edit_suites.php

示例9: VALUES

				answer_keyboard_key
				) VALUES (
				' . $answer_question_id . ',
				\'' . F_escape_sql($answer_description) . '\',
				' . F_empty_to_null($answer_explanation) . ',
				\'' . $answer_isright . '\',
				\'' . $answer_enabled . '\',
				' . F_zero_to_null($answer_position) . ',
				' . F_empty_to_null($answer_keyboard_key) . '
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
                F_db_query('ROLLBACK', $db);
                // rollback transaction
            } else {
                $answer_id = F_db_insert_id($db, K_TABLE_ANSWERS, 'answer_id');
            }
            $sql = 'COMMIT';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
                break;
            }
        }
        break;
    case 'clear':
        // Clear form fields
        $answer_description = '';
        $answer_explanation = '';
        $answer_isright = false;
        $answer_enabled = true;
        $answer_position = 0;
开发者ID:BGCX261,项目名称:zjxt-svn-to-git,代码行数:31,代码来源:tce_edit_answer.php

示例10: VALUES

            $sql = 'INSERT INTO ' . K_TABLE_DATACENTERS . ' (
				dcn_name,
				dcn_description,
				dcn_website_url,
				dcn_map_url
				) VALUES (
				\'' . F_escape_sql($dcn_name) . '\',
				' . F_empty_to_null($dcn_description) . ',
				' . F_empty_to_null($dcn_website_url) . ',
				' . F_empty_to_null($dcn_map_url) . '
				
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $dcn_id = F_db_insert_id($db, K_TABLE_DATACENTERS, 'dcn_id');
            }
            // add default permission for non administrators
            if ($userlevel < K_AUTH_ADMINISTRATOR and empty($perms)) {
                foreach ($user_groups as $grp) {
                    $perms[$grp] = 15;
                    // read + add + update + delete
                }
            }
            // insert groups permissions
            if (!empty($perms)) {
                foreach ($perms as $group_id => $pval) {
                    $sql = 'INSERT INTO ' . K_TABLE_DATACENTER_GROUPS . ' (
						dcg_dcn_id,
						dcg_group_id,
						dcg_permission
开发者ID:jayadevn,项目名称:RackMap,代码行数:31,代码来源:tce_edit_datacenters.php

示例11: VALUES

                    // check if this child already exist
                    $sqlus = 'SELECT obj_id FROM ' . K_TABLE_OBJECTS . ', ' . K_TABLE_OBJECTS_MAP . ' WHERE omp_child_obj_id=obj_id AND omp_parent_obj_id=' . $object_id . ' AND obj_name=\'' . $obj_name . '\' LIMIT 1';
                    if ($rus = F_db_query($sqlus, $db)) {
                        if (!F_db_fetch_assoc($rus)) {
                            // add new child
                            $sql = 'INSERT INTO ' . K_TABLE_OBJECTS . ' (
								obj_obt_id,
								obj_name
								) VALUES (
								' . $new_child_type . ',
								\'' . $obj_name . '\'
								)';
                            if (!($r = F_db_query($sql, $db))) {
                                F_display_db_error(false);
                            } else {
                                $cobj_id = F_db_insert_id($db, K_TABLE_OBJECTS, 'obj_id');
                            }
                            // update parent-child map
                            $sql = 'INSERT INTO ' . K_TABLE_OBJECTS_MAP . ' (
								omp_parent_obj_id,
								omp_child_obj_id
								) VALUES (
								' . $object_id . ',
								' . $cobj_id . '
								)';
                            if (!($r = F_db_query($sql, $db))) {
                                F_display_db_error(false);
                            }
                        }
                    } else {
                        F_display_db_error();
开发者ID:jayadevn,项目名称:RackMap,代码行数:31,代码来源:tce_edit_bulk_objects.php

示例12: VALUES

				rck_position_x,
				rck_position_y
				) VALUES (
				' . $sts_id . ',
				\'' . F_escape_sql($rck_name) . '\',
				' . F_empty_to_null($rck_description) . ',
				' . F_empty_to_null($rck_label) . ',
				' . F_empty_to_null($rck_tag) . ',
				' . $rck_height . ',
				' . $rck_position_x . ',
				' . $rck_position_y . '
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $rck_id = F_db_insert_id($db, K_TABLE_RACKS, 'rck_id');
            }
            // add default permission for non administrators
            if ($userlevel < K_AUTH_ADMINISTRATOR and empty($perms)) {
                foreach ($user_groups as $grp) {
                    $perms[$grp] = 15;
                    // read + add + update + delete
                }
            }
            // insert groups permissions
            if (!empty($perms)) {
                foreach ($perms as $group_id => $pval) {
                    $sql = 'INSERT INTO ' . K_TABLE_RACK_GROUPS . ' (
						rkg_rck_id,
						rkg_group_id,
						rkg_permission
开发者ID:jayadevn,项目名称:RackMap,代码行数:31,代码来源:tce_edit_racks.php

示例13: F_stripslashes_formfields

                F_stripslashes_formfields();
                break;
            }
            $sql = 'INSERT INTO ' . K_TABLE_MANUFACTURES . ' (
				mnf_name,
				mnf_url,
				mnf_description
				) VALUES (
				\'' . F_escape_sql($mnf_name) . '\',
				' . F_empty_to_null($mnf_url) . ',
				' . F_empty_to_null($mnf_description) . '
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $mnf_id = F_db_insert_id($db, K_TABLE_MANUFACTURES, 'mnf_id');
            }
            // add mac prefixes
            foreach ($macs as $k => $v) {
                $sql = 'INSERT INTO ' . K_TABLE_MANUFACTURES_MAC . ' (
					mac_mnf_id,
					mac_mac
					) VALUES (
					' . $mnf_id . ',
					\'' . F_escape_sql($v) . '\'
					)';
                if (!($r = F_db_query($sql, $db))) {
                    F_display_db_error(false);
                }
            }
        }
开发者ID:jayadevn,项目名称:RackMap,代码行数:31,代码来源:tce_edit_manufacturers.php

示例14: F_createTest

/**
 * Create user's test and returns TRUE on success.
 * @param $test_id (int) test ID.
 * @param $user_id (int) user ID.
 * @return boolean TRUE in case of success, FALSE otherwise.
 */
function F_createTest($test_id, $user_id)
{
    require_once '../config/tce_config.php';
    require_once '../../shared/code/tce_functions_tcecode.php';
    global $db, $l;
    if (F_isTestOverLimits()) {
        return false;
    }
    $test_id = intval($test_id);
    $user_id = intval($user_id);
    $firsttest = 0;
    // id of the firts test of this type
    // get test data
    $testdata = F_getTestData($test_id);
    $test_random_questions_select = F_getBoolean($testdata['test_random_questions_select']);
    $test_random_questions_order = F_getBoolean($testdata['test_random_questions_order']);
    $test_questions_order_mode = intval($testdata['test_questions_order_mode']);
    $test_random_answers_select = F_getBoolean($testdata['test_random_answers_select']);
    $test_random_answers_order = F_getBoolean($testdata['test_random_answers_order']);
    $test_answers_order_mode = intval($testdata['test_answers_order_mode']);
    $random_questions = ($test_random_questions_select or $test_random_questions_order);
    $sql_answer_position = '';
    if (!$test_random_answers_order and $test_answers_order_mode == 0) {
        $sql_answer_position = ' AND answer_position>0';
    }
    $sql_questions_order_by = '';
    switch ($test_questions_order_mode) {
        case 0:
            // position
            $sql_questions_order_by = ' AND question_position>0 ORDER BY question_position';
            break;
        case 1:
            // alphabetic
            $sql_questions_order_by = ' ORDER BY question_description';
            break;
        case 2:
            // ID
            $sql_questions_order_by = ' ORDER BY question_id';
            break;
        case 3:
            // type
            $sql_questions_order_by = ' ORDER BY question_type';
            break;
        case 4:
            // subject ID
            $sql_questions_order_by = ' ORDER BY question_subject_id';
            break;
    }
    // IDs of MCSA questions with more than one correct answer
    $right_answers_mcsa_questions_ids = '';
    // IDs of MCSA questions with more than one wrong answer
    $wrong_answers_mcsa_questions_ids = array();
    // IDs of MCMA questions with more than one answer
    $answers_mcma_questions_ids = array();
    // IDs of ORDER questions with more than one ordering answer
    $answers_order_questions_ids = '';
    // 1. create user's test entry
    // ------------------------------
    $date = date(K_TIMESTAMP_FORMAT);
    $sql = 'INSERT INTO ' . K_TABLE_TEST_USER . ' (
		testuser_test_id,
		testuser_user_id,
		testuser_status,
		testuser_creation_time
		) VALUES (
		' . $test_id . ',
		' . $user_id . ',
		0,
		\'' . $date . '\'
		)';
    if (!($r = F_db_query($sql, $db))) {
        F_display_db_error(false);
        return false;
    } else {
        // get inserted ID
        $testuser_id = F_db_insert_id($db, K_TABLE_TEST_USER, 'testuser_id');
        F_updateTestuserStat($date);
    }
    // get ID of first user's test (if exist)
    $firsttest = F_getFirstTestUser($test_id);
    // select questions
    if ($test_random_questions_select or $firsttest == 0) {
        // selected questions IDs
        $selected_questions = '0';
        // 2. for each set of subjects
        // ------------------------------
        $sql = 'SELECT *
			FROM ' . K_TABLE_TEST_SUBJSET . '
			WHERE tsubset_test_id=' . $test_id . '
			ORDER BY tsubset_type, tsubset_difficulty, tsubset_answers DESC';
        if ($r = F_db_query($sql, $db)) {
            $questions_data = array();
            while ($m = F_db_fetch_array($r)) {
                // 3. select the subjects IDs
//.........这里部分代码省略.........
开发者ID:dungvu,项目名称:tcexam,代码行数:101,代码来源:tce_functions_test.php

示例15: intval

            } else {
                $module_user_id = intval($_SESSION['session_user_id']);
            }
            $sql = 'INSERT INTO ' . K_TABLE_MODULES . ' (
				module_name,
				module_enabled,
				module_user_id
				) VALUES (
				\'' . F_escape_sql($module_name) . '\',
				\'' . $module_enabled . '\',
				\'' . $module_user_id . '\'
				)';
            if (!($r = F_db_query($sql, $db))) {
                F_display_db_error(false);
            } else {
                $module_id = F_db_insert_id($db, K_TABLE_MODULES, 'module_id');
            }
        }
        break;
    case 'clear':
        // Clear form fields
        $module_name = '';
        $module_enabled = true;
        $module_user_id = intval($_SESSION['session_user_id']);
        break;
    default:
        break;
}
//end of switch
// --- Initialize variables
if ($formstatus) {
开发者ID:BGCX261,项目名称:zjxt-svn-to-git,代码行数:31,代码来源:tce_edit_module.php


注:本文中的F_db_insert_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。