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


PHP sql_query::fetch_insert_id方法代码示例

本文整理汇总了PHP中sql_query::fetch_insert_id方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_query::fetch_insert_id方法的具体用法?PHP sql_query::fetch_insert_id怎么用?PHP sql_query::fetch_insert_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql_query的用法示例。


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

示例1:

 function action_create_contact($index)
 {
     log_debug("inc_vendors", "Executing action_create_contact({$index})");
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO vendor_contacts(vendor_id, contact, description, role)\n\t\t\t\t\t\tVALUES ('" . $this->id . "', '" . $this->data["contacts"][$index]["contact"] . "', '" . $this->data["contacts"][$index]["description"] . "', '" . $this->data["contacts"][$index]["role"] . "')";
     $sql_obj->execute();
     $this->data["contacts"][$index]["contact_id"] = $sql_obj->fetch_insert_id();
     for ($i = 0; $i < $this->data["contacts"][$index]["num_records"]; $i++) {
         if ($this->data["contacts"][$index]["records"][$i]["delete"] == "false") {
             $this->action_create_record($index, $i);
         }
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:13,代码来源:inc_vendors.php

示例2: projects

<?php

/*
	projects/ajax/insert_new_project.php

	Inserts a new project.
*/
require "../../include/config.php";
require "../../include/amberphplib/main.php";
if (user_permissions_get('projects_write')) {
    $name_project = @security_script_input_predefined("any", $_GET['name_project']);
    $code_project = config_generate_uniqueid("code_project", "SELECT id FROM projects WHERE code_project='VALUE'");
    $sql_obj = new sql_query();
    $sql_obj->string = "INSERT INTO projects (name_project, code_project) VALUES (\"" . $name_project . "\", \"" . $code_project . "\")";
    $sql_obj->execute();
    $projectid = $sql_obj->fetch_insert_id();
    echo $projectid;
    exit(0);
}
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:19,代码来源:insert_new_project.php

示例3: VALUES

 $sql_obj->trans_begin();
 if ($structure_id > 0) {
     $sql_obj->string = "UPDATE `input_structures` SET `name`= '{$structure_name}', `description` = '{$structure_description}' WHERE `id` = {$structure_id};";
     if (!$sql_obj->execute()) {
         log_debug("csv_import", "Failure to update input_structure entry.");
     }
     $sql_obj->string = "SELECT `id`, `id_structure` , `field_src`, `field_dest`, `data_format` FROM `input_structure_items` WHERE id_structure='{$structure_id}' ORDER BY `field_src` ASC";
     $sql_obj->execute();
     $sql_obj->fetch_array();
     $existing_input_structure_items = (array) $sql_obj->data;
 } else {
     $sql_obj->string = "INSERT INTO input_structures ( name, description, type_input, type_file ) VALUES ('" . $structure_name . "', '" . $structure_description . "', 'bank_statement', 'csv');";
     if (!$sql_obj->execute()) {
         log_debug("csv_import", "Failure whilst creating initial input_structure entry.");
     }
     $structure_id = $sql_obj->fetch_insert_id();
     $existing_input_structure_items = array();
 }
 // Add or edit the sub items of the input structure.
 if ($structure_id > 0) {
     $sql_parts = array();
     if (count($existing_input_structure_items) > 0) {
         $reindexed_input_structure_items = array();
         foreach ($existing_input_structure_items as $structure_row) {
             $reindexed_input_structure_items[$structure_row['field_src']] = $structure_row;
         }
         foreach ($new_input_structure as $input_structure_key => $input_structure_data) {
             $row = $reindexed_input_structure_items[$input_structure_key];
             if ($row['field_dest'] != $input_structure_data['field_dest'] || $input_structure_data['data_format'] != $row['data_format']) {
                 $sql_obj->string = "UPDATE `input_structure_items` SET `field_src` = '{$input_structure_key}', `field_dest` = '{$input_structure_data['field_dest']}', `data_format` = '{$input_structure_data['data_format']}' WHERE `id` = {$row['id']};";
                 if (!$sql_obj->execute()) {
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:bankstatement-csv-process.php

示例4: VALUES

 function action_create()
 {
     log_debug("service_groups", "Executing action_create()");
     // create a new service group
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `service_groups` (group_name) VALUES ('" . $this->data["group_name"] . "')";
     $sql_obj->execute();
     $this->id = $sql_obj->fetch_insert_id();
     return $this->id;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:10,代码来源:inc_services_groups.php

示例5: user_newuser

function user_newuser($username, $password, $realname, $email)
{
    log_debug("inc_user", "Executing user_newuser({$username}, {$password}, {$realname}, {$email})");
    // make sure that the user running this command is an admin
    if (user_permissions_get("admin")) {
        // verify data
        if ($username && $password && $realname && $email) {
            // TODO: Fix ACID compliance here
            // create the user account
            $sql_obj = new sql_query();
            $sql_obj->string = "INSERT INTO `users` (username, realname, contact_email) VALUES ('{$username}', '{$realname}', '{$email}')";
            $sql_obj->execute();
            $userid = $sql_obj->fetch_insert_id();
            // set the password
            user_changepwd($userid, $password);
            return $userid;
        }
        // if data is valid
    }
    // if user is an admin
    return 0;
}
开发者ID:frankcrawford,项目名称:namedmanager,代码行数:22,代码来源:inc_user.php

示例6: service_form_details_process


//.........这里部分代码省略.........
    //// ERROR CHECKING ///////////////////////
    // make sure we don't choose a service name that is already in use
    if ($data["code_service"]) {
        $sql_obj = new sql_query();
        $sql_obj->string = "SELECT id FROM services WHERE name_service='" . $data["name_service"] . "'";
        if ($id) {
            $sql_obj->string .= " AND id!='{$id}'";
        }
        $sql_obj->execute();
        if ($sql_obj->num_rows()) {
            $_SESSION["error"]["message"][] = "This service name is already in use by another service. Please choose a unique name.";
            $_SESSION["error"]["name_service-error"] = 1;
        }
    }
    /// if there was an error, go back to the entry page
    if ($_SESSION["error"]["message"]) {
        $_SESSION["error"]["form"]["service_{$mode}"] = "failed";
        if ($mode == "add") {
            header("Location: ../index.php?page=services/add.php");
        } else {
            header("Location: ../index.php?page=services/view.php&id={$id}");
        }
        exit(0);
    } else {
        // start transaction
        $sql_obj = new sql_query();
        $sql_obj->trans_begin();
        if ($mode == "add") {
            /*
            	Create new service
            */
            $sql_obj->string = "INSERT INTO services (name_service, typeid) VALUES ('" . $data["name_service"] . "', '" . $data["typeid"] . "')";
            $sql_obj->execute();
            $id = $sql_obj->fetch_insert_id();
        }
        if ($id) {
            /*
            	Update general service details
            */
            $sql_obj->string = "UPDATE services SET " . "name_service='" . $data["name_service"] . "', " . "chartid='" . $data["chartid"] . "', " . "id_service_group='" . $data["id_service_group"] . "', " . "id_service_group_usage='" . $data["id_service_group_usage"] . "', " . "description='" . $data["description"] . "', " . "upstream_id='" . $data["upstream_id"] . "', " . "upstream_notes='" . $data["upstream_notes"] . "' " . "WHERE id='{$id}' LIMIT 1";
            $sql_obj->execute();
            /*
            	Update service tax options
            */
            // delete existing tax options for this service (if any)
            $sql_obj->string = "DELETE FROM services_taxes WHERE serviceid='{$id}'";
            $sql_obj->execute();
            // fetch list of tax IDs
            $sql_tax_obj = new sql_query();
            $sql_tax_obj->string = "SELECT id FROM account_taxes";
            $sql_tax_obj->execute();
            if ($sql_tax_obj->num_rows()) {
                $sql_tax_obj->fetch_array();
                foreach ($sql_tax_obj->data as $data_tax) {
                    if ($data["tax_" . $data_tax["id"]] == "on") {
                        // enable selected tax options
                        $sql_obj->string = "INSERT INTO services_taxes (serviceid, taxid) VALUES ('{$id}', '" . $data_tax["id"] . "')";
                        $sql_obj->execute();
                    }
                }
            }
            // end of loop through taxes
            /*
            	Update Journal
            */
            if ($mode == "add") {
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:67,代码来源:inc_services_process.php

示例7: VALUES

 function action_create()
 {
     log_debug("inc_staff", "Executing action_create()");
     // create a new employee record
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `staff` (name_staff) VALUES ('" . $this->data["name_staff"] . "')";
     $sql_obj->execute();
     $this->id = $sql_obj->fetch_insert_id();
     return $this->id;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:10,代码来源:inc_staff.php

示例8: VALUES

 function action_create()
 {
     log_debug("journal_process", "Executing action_create()");
     // insert place holder into DB
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `journal` (journalname, type, timestamp) VALUES ('" . $this->journalname . "', '" . $this->structure["type"] . "', '" . $this->structure["timestamp"] . "')";
     if ($sql_obj->execute()) {
         $this->structure["id"] = $sql_obj->fetch_insert_id();
         return $this->structure["id"];
     }
     return 0;
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:12,代码来源:inc_journal.php

示例9: VALUES

 function action_create()
 {
     log_debug("name_server_group", "Executing action_create()");
     // create a new server group
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `name_servers_groups` (group_name, group_description) VALUES ('" . $this->data["group_name"] . "', '" . $this->data["group_description"] . "')";
     $sql_obj->execute();
     $this->id = $sql_obj->fetch_insert_id();
     return $this->id;
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:10,代码来源:inc_server_groups.php

示例10: VALUES

 function action_create()
 {
     log_debug("inc_charts", "Executing action_create()");
     // create a new chart
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `account_charts` (chart_type) VALUES ('" . $this->data["chart_type"] . "')";
     $sql_obj->execute();
     $this->id = $sql_obj->fetch_insert_id();
     return $this->id;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:10,代码来源:inc_charts.php

示例11:

 function action_create()
 {
     log_debug("attributes", "Executing action_create()");
     // create a new attribute
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `attributes` ( id, type, id_owner, id_group, `key`, value) \n\t\t\t\t\t\tVALUES ('" . $this->id . "', '" . $this->type . "', '" . $this->id_owner . "', '" . $this->id_group . "', '" . $this->data["key"] . "', '" . $this->data["value"] . "')";
     $sql_obj->execute();
     $this->id = $sql_obj->fetch_insert_id();
     //		return $this->id;
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:11,代码来源:inc_attributes.php

示例12: VALUES

 function action_create()
 {
     log_debug("inc_gl", "Executing action_create()");
     // create a new transaction
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `account_gl` (description) VALUES ('" . $this->data["description"] . "')";
     $sql_obj->execute();
     $this->id = $sql_obj->fetch_insert_id();
     return $this->id;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:10,代码来源:inc_gl.php

示例13: VALUES

 function action_create()
 {
     log_debug("name_server", "Executing action_create()");
     // create a new server
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO `name_servers` (server_name, server_description, api_sync_config, api_sync_log) VALUES ('" . $this->data["server_name"] . "', '', '1', '1')";
     $sql_obj->execute();
     $this->id = $sql_obj->fetch_insert_id();
     // assign the server to the domains
     return $this->id;
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:11,代码来源:inc_servers.php

示例14: header

     $_SESSION["error"]["form"]["timebilled_view"] = "failed";
     header("Location: ../index.php?page=projects/timebilled-edit.php&id={$projectid}&groupid={$groupid}");
     exit(0);
 } else {
     /*
     	Start Transaction
     */
     $sql_obj = new sql_query();
     $sql_obj->trans_begin();
     /*
     	Add a new group (if required)
     */
     if ($mode == "add") {
         $sql_obj->string = "INSERT INTO `time_groups` (projectid) VALUES ('{$projectid}')";
         $sql_obj->execute();
         $groupid = $sql_obj->fetch_insert_id();
     }
     if ($groupid) {
         /*
         	Update details
         */
         $sql_obj->string = "UPDATE time_groups SET " . "name_group='" . $data["name_group"] . "', " . "customerid='" . $data["customerid"] . "', " . "description='" . $data["description"] . "' " . "WHERE id='{$groupid}'";
         $sql_obj->execute();
         /*
         	Update time entries
         
         	Here we run though all the entries returned from the database, and
         	then compare them to the entries that the user has selected.
         
         	This will allow us to work out if there have been any changes - eg: changed
         	from billable to non-billable, or removed from the group.
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:timebilled-edit-process.php

示例15: VALUES

 function action_create()
 {
     log_write("debug", "file_storage", "Executing action_create()");
     $sql_obj = new sql_query();
     $sql_obj->string = "INSERT INTO file_uploads (customid, type) VALUES ('" . $this->data["customid"] . "', '" . $this->data["type"] . "')";
     if (!$sql_obj->execute()) {
         return 0;
     }
     $this->id = $sql_obj->fetch_insert_id();
     return $this->id;
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:11,代码来源:inc_file_uploads.php


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