本文整理汇总了PHP中dbstuff::insert_id方法的典型用法代码示例。如果您正苦于以下问题:PHP dbstuff::insert_id方法的具体用法?PHP dbstuff::insert_id怎么用?PHP dbstuff::insert_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbstuff
的用法示例。
在下文中一共展示了dbstuff::insert_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: VALUES
if (is_dir(ROOT_PATH . 'data/backup_' . $backupdir)) {
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('backupdir', '{$backupdir}')");
}
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$siteuniqueid = 'DZZOFFICE' . $chars[date('y') % 60] . $chars[date('n')] . $chars[date('j')] . $chars[date('G')] . $chars[date('i')] . $chars[date('s')] . substr(md5($onlineip . $timestamp), 0, 4) . random(4);
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('authkey', '{$authkey}')");
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('siteuniqueid', '{$siteuniqueid}')");
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('adminemail', '{$adminemail}')");
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('backupdir', '" . $backupdir . "')");
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('verhash', '" . random(3) . "')");
//创建默认机构
if ($company) {
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('sitename', '" . $company . "')");
$db->query("REPLACE INTO {$tablepre}setting (skey, svalue) VALUES ('bbname', '" . $company . "')");
$db->query("INSERT INTO {$tablepre}organization ( `orgname`, `forgid`, `fid`, `disp`, `dateline`, `usesize`, `maxspacesize`, `indesk`,`available`) VALUES( '{$company}', 0, 0, 0, '{$timestamp}', 0, 0, 0,0)");
$orgid = $db->insert_id();
//将管理员加入默认机构
if ($orgid) {
$db->query("INSERT INTO {$tablepre}organization_user (`orgid`, `uid`,`jobid`, `dateline`) VALUES('{$orgid}', 1, 0, '{$timestamp}')");
}
}
$db->query("UPDATE {$tablepre}cron SET lastrun='0', nextrun='" . ($timestamp + 3600) . "'");
for ($i = 0; $i < 5; $i++) {
showjsmessage('正在设置系统...成功!');
}
for ($i = 0; $i < 5; $i++) {
showjsmessage('正在导入区划数据...');
}
install_districtdata();
for ($i = 0; $i < 5; $i++) {
showjsmessage('正在导入区划数据...成功!');
示例2: foreach
$memberfields['groupid'] = $db->result($query, 0);
$memberfields['adminid'] = 0;
}
$memberfields['timeoffset'] = !$memberfields['timeoffset'] ? 9999 : $memberfields['timeoffset'];
$memberfields['newsletter'] = !$memberfields['newsletter'] ? 1 : $memberfields['newsletter'];
$sql1 = $sql2 = $comma = '';
foreach ($table_member_columns as $field) {
if (isset($memberfields[$field])) {
$sql1 .= "{$comma}{$field}";
$sql2 .= "{$comma}'{$memberfields[$field]}'";
$comma = ', ';
}
}
$db->query("INSERT INTO {$tablepre}members ({$sql1}) VALUES ({$sql2})");
$table_memberfields_columns[] = 'uid';
$memberfields['uid'] = $member['uid'] = $db->insert_id();
$member['secques'] = '';
$sql1 = $sql2 = $comma = '';
foreach ($table_memberfields_columns as $field) {
if (isset($memberfields[$field])) {
$sql1 .= "{$comma}{$field}";
$sql2 .= "{$comma}'{$memberfields[$field]}'";
$comma = ', ';
}
}
$db->query("REPLACE INTO {$tablepre}memberfields ({$sql1}) VALUES ({$sql2})");
$_DCACHE['settings']['lastmember'] = $memberfields['username'];
$_DCACHE['settings']['totalmembers']++;
updatemembercache();
}
dsetcookie('sid', '', -86400 * 365);
示例3: runquery
$ucsql && runquery($ucsql, FALSE);
$appauthkey = _generate_key();
$ucdbhost = $dbhost;
$ucdbname = $dbname;
$ucdbuser = $dbuser;
$ucdbpw = $dbpw;
$ucdbcharset = $dbcharset;
$uccharset = $charset;
$pathinfo = pathinfo($_SERVER['PHP_SELF']);
$pathinfo['dirname'] = substr($pathinfo['dirname'], 0, -8);
$appurl = 'http://' . preg_replace("/\\:\\d+/", '', $_SERVER['HTTP_HOST']) . ($_SERVER['SERVER_PORT'] && $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '') . $pathinfo['dirname'];
$ucapi = $appurl . '/uc_server';
$ucip = '127.0.0.1';
$app_tagtemplates = 'apptagtemplates[template]=' . urlencode('<a href="{url}" target="_blank">{subject}</a>') . '&' . 'apptagtemplates[fields][subject]=' . urlencode($lang['tagtemplates_subject']) . '&' . 'apptagtemplates[fields][uid]=' . urlencode($lang['tagtemplates_uid']) . '&' . 'apptagtemplates[fields][username]=' . urlencode($lang['tagtemplates_username']) . '&' . 'apptagtemplates[fields][dateline]=' . urlencode($lang['tagtemplates_dateline']) . '&' . 'apptagtemplates[fields][url]=' . urlencode($lang['tagtemplates_url']);
$db->query("INSERT INTO {$uctablepre}applications SET name='Discuz! Board', url='{$appurl}', ip='{$ucip}', authkey='{$appauthkey}', synlogin='1', charset='{$charset}', dbcharset='{$dbcharset}', type='DISCUZ', recvnote='1', tagtemplates='{$apptagtemplates}'", $link);
$appid = $db->insert_id($link);
if ($appid < 1) {
instmsg('reg_app_to_ucenter_fail');
}
$db->query("ALTER TABLE {$uctablepre}notelist ADD COLUMN app{$appid} tinyint NOT NULL");
$config = "{$appauthkey}|{$appid}|{$ucdbhost}|{$ucdbname}|{$ucdbuser}|{$ucdbpw}|{$ucdbcharset}|{$uctablepre}|{$uccharset}|{$ucapi}|{$ucip}";
save_uc_config($config, DISCUZ_ROOT . './config.inc.php');
$username = getgpc('username', 'p');
$email = getgpc('email', 'p');
$password1 = getgpc('password1', 'p');
$password2 = getgpc('password2', 'p');
$uid = 0;
if ($username && $email && $password1 && $password2) {
if ($password1 != $password2) {
$error_admin['password2'] = 'admin_password_invalid';
} elseif (strlen($username) > 15 || preg_match("/^\$|^c:\\con\\con\$|║║|[,\"\\s\t\\<\\>&]|^сн©м|^Guest/is", $username)) {