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


PHP DBLayer::insert_id方法代码示例

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


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

示例1: error

 if ($db_type != 'pgsql') {
     $query['INSERT'] .= ', g_id';
     $query['VALUES'] .= ', 4';
 }
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 // Insert guest and first admin user
 $query = array('INSERT' => 'group_id, username, password, email', 'INTO' => 'users', 'VALUES' => '2, \'Guest\', \'Guest\', \'Guest\'');
 if ($db_type != 'pgsql') {
     $query['INSERT'] .= ', id';
     $query['VALUES'] .= ', 1';
 }
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $salt = random_key(12);
 $query = array('INSERT' => 'group_id, username, password, email, language, num_posts, last_post, registered, registration_ip, last_visit, salt', 'INTO' => 'users', 'VALUES' => '1, \'' . $forum_db->escape($username) . '\', \'' . forum_hash($password1, $salt) . '\', \'' . $forum_db->escape($email) . '\', \'' . $forum_db->escape($default_lang) . '\', 1, ' . $now . ', ' . $now . ', \'127.0.0.1\', ' . $now . ', \'' . $forum_db->escape($salt) . '\'');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $new_uid = $forum_db->insert_id();
 // Enable/disable avatars depending on file_uploads setting in PHP configuration
 $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0;
 // Enable/disable automatic check for updates depending on PHP environment (require cURL, fsockopen or allow_url_fopen)
 $check_for_updates = function_exists('curl_init') || function_exists('fsockopen') || in_array(strtolower(@ini_get('allow_url_fopen')), array('on', 'true', '1')) ? 1 : 0;
 // Insert config data
 $config = array('o_cur_version' => "'" . FORUM_VERSION . "'", 'o_database_revision' => "'" . FORUM_DB_REVISION . "'", 'o_board_title' => "'" . $forum_db->escape($board_title) . "'", 'o_board_desc' => "'" . $forum_db->escape($board_descrip) . "'", 'o_default_timezone' => "'0'", 'o_time_format' => "'H:i:s'", 'o_date_format' => "'Y-m-d'", 'o_check_for_updates' => "'{$check_for_updates}'", 'o_check_for_versions' => "'{$check_for_updates}'", 'o_timeout_visit' => "'5400'", 'o_timeout_online' => "'300'", 'o_redirect_delay' => "'0'", 'o_show_version' => "'0'", 'o_show_user_info' => "'1'", 'o_show_post_count' => "'1'", 'o_signatures' => "'1'", 'o_smilies' => "'1'", 'o_smilies_sig' => "'1'", 'o_make_links' => "'1'", 'o_default_lang' => "'" . $forum_db->escape($default_lang) . "'", 'o_default_style' => "'Oxygen'", 'o_default_user_group' => "'3'", 'o_topic_review' => "'15'", 'o_disp_topics_default' => "'30'", 'o_disp_posts_default' => "'25'", 'o_indent_num_spaces' => "'4'", 'o_quote_depth' => "'3'", 'o_quickpost' => "'1'", 'o_users_online' => "'1'", 'o_censoring' => "'0'", 'o_ranks' => "'1'", 'o_show_dot' => "'0'", 'o_topic_views' => "'1'", 'o_quickjump' => "'1'", 'o_gzip' => "'0'", 'o_additional_navlinks' => "''", 'o_report_method' => "'0'", 'o_regs_report' => "'0'", 'o_default_email_setting' => "'1'", 'o_mailing_list' => "'" . $forum_db->escape($email) . "'", 'o_avatars' => "'{$avatars}'", 'o_avatars_dir' => "'img/avatars'", 'o_avatars_width' => "'60'", 'o_avatars_height' => "'60'", 'o_avatars_size' => "'15360'", 'o_search_all_forums' => "'1'", 'o_sef' => "'Default'", 'o_admin_email' => "'" . $forum_db->escape($email) . "'", 'o_webmaster_email' => "'" . $forum_db->escape($email) . "'", 'o_subscriptions' => "'1'", 'o_smtp_host' => "NULL", 'o_smtp_user' => "NULL", 'o_smtp_pass' => "NULL", 'o_smtp_ssl' => "'0'", 'o_regs_allow' => "'1'", 'o_regs_verify' => "'0'", 'o_announcement' => "'0'", 'o_announcement_heading' => "'" . $lang_install['Default announce heading'] . "'", 'o_announcement_message' => "'" . $lang_install['Default announce message'] . "'", 'o_rules' => "'0'", 'o_rules_message' => "'" . $lang_install['Default rules'] . "'", 'o_maintenance' => "'0'", 'o_maintenance_message' => "'" . $lang_admin_settings['Maintenance message default'] . "'", 'o_default_dst' => "'0'", 'p_message_bbcode' => "'1'", 'p_message_img_tag' => "'1'", 'p_message_all_caps' => "'1'", 'p_subject_all_caps' => "'1'", 'p_sig_all_caps' => "'1'", 'p_sig_bbcode' => "'1'", 'p_sig_img_tag' => "'0'", 'p_sig_length' => "'400'", 'p_sig_lines' => "'4'", 'p_allow_banned_email' => "'1'", 'p_allow_dupe_email' => "'0'", 'p_force_guest_email' => "'1'", 'o_show_moderators' => "'0'", 'o_mask_passwords' => "'1'");
 foreach ($config as $conf_name => $conf_value) {
     $query = array('INSERT' => 'conf_name, conf_value', 'INTO' => 'config', 'VALUES' => '\'' . $conf_name . '\', ' . $conf_value . '');
     $forum_db->query_build($query) or error(__FILE__, __LINE__);
 }
 // Insert some other default data
 $query = array('INSERT' => 'cat_name, disp_position', 'INTO' => 'categories', 'VALUES' => '\'' . $lang_install['Default category name'] . '\', 1');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
 $query = array('INSERT' => 'forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id', 'INTO' => 'forums', 'VALUES' => '\'' . $lang_install['Default forum name'] . '\', \'' . $lang_install['Default forum descrip'] . '\', 1, 1, ' . $now . ', 1, \'' . $forum_db->escape($username) . '\', 1, ' . $forum_db->insert_id() . '');
 $forum_db->query_build($query) or error(__FILE__, __LINE__);
开发者ID:heiswayi,项目名称:ishare-plus,代码行数:31,代码来源:install.php


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