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


PHP sql_db::insert_id方法代码示例

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


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

示例1: time

 if (!isset($_POST['currency'])) {
     $errors[] = 'currency';
 }
 if (count($errors) > 0) {
     if ($is_ajax) {
         echo json_encode($errors);
         die;
     } else {
         include "form.php";
         exit;
     }
 }
 $db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
 $created = time();
 $db->query("INSERT INTO members_changes SET\n\t\t\t\t            m_created = " . $created . ",\n\t\t\t\t            m_type = 'add',\n\t\t\t\t            m_state = 'awaiting',\n\t\t\t\t            m_nick = '" . $db->check($_POST["nick"]) . "',\n\t\t\t\t            m_name = '" . $db->check($_POST["name"] . " " . $_POST["surname"]) . "',\n\t\t\t\t            m_mail = '" . $db->check($_POST["email"]) . "',\n\t\t\t\t            m_address = '" . $db->check($_POST["address"] . ", " . $_POST["zip"] . " " . $_POST["city"] . ", " . $_POST["country"]) . "',\n\t\t\t\t            m_year = '" . $db->check($_POST["birth"]) . "',\n\t\t\t\t            m_jabber = '',\n\t\t\t\t            m_how = '" . $db->check($_POST["how"]) . "',\n\t\t\t\t            m_note = '" . $db->check($_POST["note"]) . "',\n\t\t\t\t            m_distribution = '" . $db->check($_POST["distribution"]) . "',\n\t\t\t\t            m_location = '" . $db->check($_POST["location"]) . "',\n\t\t\t\t            m_currency = '" . $db->check($_POST["currency"]) . "',\n\t\t\t\t            m_reason = '',\n\t\t\t\t            m_addr = '" . $db->check($_SERVER["REMOTE_ADDR"]) . "',\n\t\t\t\t            m_addr_reverse = '" . $db->check(gethostbyaddr($_SERVER["REMOTE_ADDR"])) . "',\n\t\t\t\t            m_last_mail_id = 1\n\t\t\t\t            ");
 $request_id = $db->insert_id();
 // Mail admins
 $admins = explode(",", cfg_get("mailer_requests_sendto"));
 $subject = cfg_get("mailer_requests_admin_sub");
 $text = cfg_get("mailer_requests_admin_text");
 $subject = str_replace("%request_id%", $request_id, $subject);
 $subject = str_replace("%type%", "add", $subject);
 $subject = str_replace("%state%", "awaiting", $subject);
 $subject = str_replace("%member_id%", "-", $subject);
 $subject = str_replace("%member%", "-", $subject);
 $subject = str_replace("%name%", $_POST["name"] . " " . $_POST["surname"], $subject);
 $text = str_replace("%created%", strftime("%Y-%m-%d %H:%M", $created), $text);
 $text = str_replace("%changed_at%", "-", $text);
 $text = str_replace("%request_id%", $request_id, $text);
 $text = str_replace("%type%", "add", $text);
 $text = str_replace("%state%", "awaiting", $text);
开发者ID:Jakuje,项目名称:www.vpsfree.cz,代码行数:31,代码来源:prihlaska.php

示例2: define

     file_put_contents(NV_ROOTDIR . '/robots.txt', $contents, LOCK_EX);
 }
 define('NV_IS_MODADMIN', true);
 $module_name = 'upload';
 $lang_global['mod_upload'] = 'upload';
 $global_config['upload_logo'] = '';
 define('NV_UPLOAD_GLOBALTABLE', $db_config['prefix'] . '_upload');
 define('SYSTEM_UPLOADS_DIR', NV_UPLOADS_DIR);
 require_once NV_ROOTDIR . '/' . NV_ADMINDIR . '/upload/functions.php';
 $real_dirlist = array();
 foreach ($allow_upload_dir as $dir) {
     $real_dirlist = nv_listUploadDir($dir, $real_dirlist);
 }
 foreach ($real_dirlist as $dirname) {
     try {
         $array_dirname[$dirname] = $db->insert_id("INSERT INTO " . NV_UPLOAD_GLOBALTABLE . "_dir (dirname, time, thumb_type, thumb_width, thumb_height, thumb_quality) VALUES ('" . $dirname . "', '0', '0', '0', '0', '0')", "did");
     } catch (PDOException $e) {
         trigger_error($e->getMessage());
     }
 }
 // Data Counter
 $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('c_time', 'start', 0, 0, 0)");
 $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('c_time', 'last', 0, 0, 0)");
 $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('total', 'hits', 0, 0, 0)");
 $year = date('Y');
 for ($i = 0; $i < 9; $i++) {
     $db->query("INSERT INTO " . $db_config['prefix'] . "_counter VALUES ('year', '" . $year . "', 0, 0, 0)");
     ++$year;
 }
 $ar_tmp = explode(',', 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec');
 foreach ($ar_tmp as $month) {
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:31,代码来源:index.php


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