本文整理汇总了PHP中DB::result方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::result方法的具体用法?PHP DB::result怎么用?PHP DB::result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::result方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usesubmit
function usesubmit()
{
global $_G;
if (empty($_G['gp_pid'])) {
showmessage(lang('magic/namepost', 'namepost_info_nonexistence'));
}
$_G['tid'] = $_G['gp_ptid'];
$post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous'));
$this->_check($post);
$query = DB::query("SELECT username FROM " . DB::table('common_member') . " WHERE uid='{$post['authorid']}'");
$author = daddslashes(DB::result($query, 0), 1);
$thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter'));
$posttable = getposttablebytid($post['tid']);
if ($post['first']) {
$lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : $author;
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE tid='{$post['tid']}' AND first='1'");
} else {
$lastposter = $author;
$author = $thread['author'];
DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE pid='{$_G['gp_pid']}'");
}
$forum['lastpost'] = explode("\t", DB::result_first("SELECT lastpost FROM " . DB::table('forum_forum') . " WHERE fid='{$post['fid']}'"));
if ($thread['subject'] == $forum['lastpost'][1] && ($forum['lastpost'][3] == '' && $post['anonymous'])) {
$lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}";
DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='{$post['fid']}'", 'UNBUFFERED');
}
DB::query("UPDATE " . DB::table('forum_thread') . " SET author='{$author}', lastposter='{$lastposter}' WHERE tid='{$post['tid']}'");
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']);
if ($post['authorid'] != $_G['uid']) {
notification_add($post['authorid'], 'magic', lang('magic/namepost', 'namepost_notification'), array('pid' => $_G['gp_pid'], 'tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/namepost', 'namepost_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
}
示例2: pick_count
function pick_count()
{
//clear_pick_cache(1);//缓存定期清理
//clear_search_index(1);//清除索引
clear_log(1);
//清除日志
pload('C:cache');
$arr['search_index']['name'] = milu_lang('rules_search_index');
$arr['search_index']['msg'] = milu_lang('search_index_notice');
$arr['search_index']['show'] = '<span style=" width:120px; float:left">' . milu_lang('search_index_c') . '<hr>';
$type_arr = array('1' => milu_lang('fast_pick_rules'), '2' => milu_lang('dxc_system_rules'), '3' => milu_lang('fastpick_evo'));
$type_arr2 = array('3' => milu_lang('server_'), '4' => milu_lang('local_'));
foreach ($type_arr as $k => $v) {
foreach ($type_arr2 as $k2 => $v2) {
$type = $k . $k2;
$show_name = '<span style=" width:120px; float:left">' . $type_arr[$k] . $type_arr2[$k2] . '</span>';
$search_index_count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_searchindex') . " WHERE type='{$type}'"), 0);
$arr['search_index']['show'] .= $show_name . ' ' . $search_index_count . '<br />';
}
}
$log_info = IO::info(PICK_DIR . '/data/log');
$arr['log']['name'] = milu_lang('log_size');
$arr['log']['msg'] = milu_lang('auto_pick_notice');
$arr['log']['show'] = sizecount($log_info['size']);
$cache_info = IO::info(PICK_CACHE, 1, 1);
$arr['cache']['name'] = milu_lang('cache_file_size');
$arr['cache']['show'] = milu_lang('cache_size_value', array('s' => sizecount($cache_info['size']), 'p' => PICK_CACHE_SIZE));
$arr['cache']['msg'] = milu_lang('cache_notice');
return $arr;
}
示例3: category_get_list
function category_get_list($cat, $wheresql, $page = 1, $perpage = 15)
{
global $_G;
$start = ($page - 1) * $perpage;
if ($start < 0) {
$start = 0;
}
$list = array();
$pricount = 0;
$multi = '';
$count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('portal_article_title') . " at WHERE {$wheresql}"), 0);
if ($count) {
$query = DB::query("SELECT * FROM " . DB::table('portal_article_title') . " at WHERE {$wheresql} ORDER BY at.dateline DESC LIMIT {$start},{$perpage}");
while ($value = DB::fetch($query)) {
$value['catname'] = $value['catid'] == $cat['catid'] ? $cat['catname'] : $_G['cache']['portalcategory'][$value['catid']]['catname'];
if ($value['pic']) {
$value['pic'] = pic_get($value['pic'], 'portal', $value['thumb'], $value['remote']);
}
$value['dateline'] = dgmdate($value['dateline']);
if ($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
$list[] = $value;
} else {
$pricount++;
}
}
$multi = multi($count, $perpage, $page, $cat['caturl']);
}
return $return = array('list' => $list, 'count' => $count, 'multi' => $multi, 'pricount' => $pricount);
}
示例4: build_cache_modreasons
function build_cache_modreasons()
{
$data = array();
$query = DB::query("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='modreasons'");
$modreasons = DB::result($query, 0);
$modreasons = str_replace(array("\r\n", "\r"), array("\n", "\n"), $modreasons);
$data = explode("\n", trim($modreasons));
save_syscache('modreasons', $data);
}
示例5: _HCM_countusers
function _HCM_countusers($kategorie = null)
{
if (isset($kategorie)) {
$cond = " WHERE " . _sqlWhereColumn("`group`", $kategorie);
} else {
$cond = "";
}
return DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-users`" . $cond), 0);
}
示例6: _HCM_countart
function _HCM_countart($kategorie = null)
{
if (isset($kategorie) and $kategorie != "") {
$cond = " AND " . _sqlArticleWhereCategories($kategorie);
} else {
$cond = "";
}
return DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-articles` AS art WHERE " . _sqlArticleFilter() . $cond), 0);
}
示例7: build_cache_domainwhitelist
function build_cache_domainwhitelist()
{
$query = DB::query("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='domainwhitelist'");
if ($result = DB::result($query, 0)) {
$data = explode("\r\n", $result);
} else {
$data = array();
}
save_syscache('domainwhitelist', $data);
}
示例8: query
public static function query($query)
{
if (empty(self::$db)) {
self::$db = new mysqli('localhost', 'root', '', 'forforce');
}
self::$result = self::$db->query($query);
if (self::$result === false) {
throw new Exception(self::error(), 1);
}
return self::$result;
}
示例9: _admin_catitemOutput
function _admin_catitemOutput($item, $pad = false)
{
if ($pad == true) {
$pad = " class='lpad'";
} else {
$pad = "";
}
if ($item['type'] == 2) {
$title = "<a href='index.php?p=content-articles-list&cat=" . $item['id'] . "' class='block'><img src='images/icons/dir.png' alt='col' class='icon' /><strong>" . $item['title'] . "</strong></a>";
} else {
$title = $item['title'];
}
return "<tr><td" . $pad . ">" . $title . "</td><td>" . DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-articles` WHERE (home1=" . $item['id'] . " OR home2=" . $item['id'] . " OR home3=" . $item['id'] . ")" . _admin_artAccess()), 0) . "</td></tr>\n";
}
示例10: run_timing
function run_timing($a)
{
global $_G;
$timestamp = TIMESTAMP;
$processname = 'TIMING_CRON_CHECK';
$check = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_timing') . " WHERE public_dateline<='{$timestamp}' "), 0);
if ($check) {
discuz_process::unlock($processname);
}
if (discuz_process::islocked($processname, 600)) {
return false;
}
if (!$check) {
return FALSE;
}
@set_time_limit(1000);
@ignore_user_abort(TRUE);
//防止发生异常,先预订一个1小时的总时间,假如发布文章需要2小时才完成。还未到2小时,又被触发了,这样会造成文章的重复发布
save_syscache('pick_timing', TIMESTAMP + 60 * 60 * 1);
$optype_arr = array(1 => 'move_portal', 2 => 'move_forums', 3 => 'move_blog');
$query = DB::query("SELECT * FROM " . DB::table('strayer_timing') . " WHERE public_dateline<='{$timestamp}' ORDER by public_dateline");
$timing_aid_arr = $tid_arr = $args = array();
while ($rs = DB::fetch($query)) {
$timing_aid_arr[] = dstripslashes($rs);
$tid_arr[] = $rs['id'];
}
if (!$timing_aid_arr) {
return;
}
pload('F:article,F:pick');
article_timing_delete($tid_arr);
//不管有没有发布成功,先清理掉定时发布表里面的数据,防止文章又被重复检测到
foreach ($timing_aid_arr as $k => $rs) {
$args = unserialize($rs['public_info']);
$args['aid'] = array($rs['data_id']);
$args['pid'] = $rs['pid'];
$args['timing'] = 1;
$args['cron_run'] = 1;
$args['public_time'][$rs['data_id']] = $rs['public_dateline'];
article_import($optype_arr[$rs['public_type']], $args);
}
save_syscache('pick_timing', TIMESTAMP + 600);
//成功运行,时间按正常设置
discuz_process::unlock($processname);
return true;
}
示例11: show
function show()
{
global $_G;
$id = intval($_GET['id']);
$idtype = $_GET['idtype'];
$blog = magic_check_idtype($id, $idtype);
if (DB::result(DB::query('SELECT COUNT(*) FROM ' . DB::table('common_magiclog') . " WHERE action='2' AND uid = '{$_G['uid']}' AND targetid = '{$id}' AND idtype = '{$idtype}' AND magicid = '{$this->magic[magicid]}'"), 0)) {
showmessage("magicuse_object_once_limit");
}
$num = !empty($_G['setting']['feedhotmin']) ? intval($_G['setting']['feedhotmin']) : 3;
magicshowtips(lang('magic/hot', 'hot_info', array('num' => $num)));
echo <<<HTML
<p>
\t<input type="hidden" name="id" value="'.{$id}.'" />
\t<input type="hidden" name="idtype" value="'.{$idtype}.'" />
</p>
HTML;
}
示例12: fetch_all_for_search
public function fetch_all_for_search($view, $order, $searchkey, $type, $frienduid, $spaceuid, $minhot, $count = 0, $start = 0, $limit = 0)
{
$today = strtotime(dgmdate(TIMESTAMP, 'Y-m-d'));
$wheresql = '1';
$threadsql = $ordersql = $apply_sql = '';
if ($view == 'all') {
if ($order == 'hot') {
$threadsql .= " t.special='4' AND t.replies>='{$minhot}'";
$apply_sql = "INNER JOIN " . DB::table('forum_thread') . " t ON t.special='4' AND t.tid = a.tid AND t.replies>='{$minhot}' AND t.displayorder>'-1'";
}
} elseif ($view == 'me') {
$type = in_array($type, array('orig', 'apply')) ? $type : 'orig';
if ($type == 'apply') {
$wheresql = "1";
$apply_sql = "INNER JOIN " . DB::table('forum_activityapply') . " apply ON apply.uid = '{$spaceuid}' AND apply.tid = a.tid";
} else {
$wheresql = "a.uid = '{$spaceuid}'";
}
$ordersql = 'DESC';
} else {
if ($frienduid) {
$wheresql = "a." . DB::field('uid', $frienduid);
}
$ordersql = 'DESC';
}
if ($view != 'all') {
} elseif (empty($order)) {
$ordersql = 'DESC';
}
if ($searchkey) {
$threadsql .= " AND t.subject LIKE " . DB::quote('%' . addslashes($searchkey) . '%');
}
if ($count) {
return DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('forum_activity') . " a {$apply_sql} WHERE {$wheresql}"), 0);
}
if ($view == 'all' && $order == 'hot') {
$apply_sql = '';
}
$threadsql = empty($threadsql) ? '' : $threadsql . ' AND ';
return DB::fetch_all("SELECT a.*, t.* FROM " . DB::table('forum_activity') . " a {$apply_sql}\r\n\t\t\tINNER JOIN " . DB::table('forum_thread') . " t ON {$threadsql} t.tid=a.tid\r\n\t\t\tWHERE t.displayorder>'-1' AND {$wheresql}\r\n\t\t\tORDER BY a.starttimefrom {$ordersql} " . DB::limit($start, $limit));
}
示例13: getglobal
if ($val !== false) {
if ($fieldid == 'realname' && $_G['uid'] != $space['uid'] && !ckrealname(1)) {
continue;
}
if ($field['formtype'] == 'file' && $val) {
$imgurl = getglobal('setting/attachurl') . './profile/' . $val;
$val = '<span><a href="' . $imgurl . '" target="_blank"><img src="' . $imgurl . '" style="max-width: 500px;" /></a></span>';
}
if ($val == '') {
$val = '-';
}
$profiles[$fieldid] = array('title' => $field['title'], 'value' => $val);
}
}
}
$count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('forum_moderator') . " WHERE uid = '{$space['uid']}'"), 0);
if ($count) {
$query = DB::query("SELECT f.name,f.fid AS fid FROM " . DB::table('forum_moderator') . " m LEFT JOIN " . DB::table('forum_forum') . " f USING(fid) WHERE uid = '{$space['uid']}'");
while ($result = DB::fetch($query)) {
$manage_forum[$result['fid']] = $result['name'];
}
}
if (!$_G['inajax'] && $_G['setting']['groupstatus']) {
$groupcount = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_groupuser') . " WHERE uid = '{$space['uid']}'");
if ($groupcount > 0) {
$query = DB::query("SELECT fg.fid, ff.name FROM " . DB::table('forum_groupuser') . " fg LEFT JOIN " . DB::table('forum_forum') . " ff USING(fid) WHERE fg.uid = '{$space['uid']}' LIMIT {$groupcount}");
while ($result = DB::fetch($query)) {
$usergrouplist[] = $result;
}
}
}
示例14: cloud_match_rules
function cloud_match_rules($get_type, $url, $content)
{
global $_G;
pload('F:fastpick');
$setting = get_pick_set();
$pick_config = $_G['cache']['evn_milu_pick']['pick_config'];
$server_cache_time = $pick_config['index_server_cache_time'];
if ($get_type == '3') {
//智能学习规则索引过期时间比较短
$server_cache_time = $pick_config['evo_index_server_cache_time'];
}
$milu_set = pick_common_get();
if ($setting['open_cloud_pick'] != 1) {
return FALSE;
}
pload('F:copyright');
$host_info = GetHostInfo($url);
$domain = $host_info['host'];
$domain_hash = md5($domain);
$url_temp = preg_replace('/\\d+/', '', $url);
$arr_temp = parse_url($url_temp);
$path_hash = md5($arr_temp['path']);
$over_dateline = $_G['timestamp'] - $server_cache_time;
$count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_searchindex') . " WHERE domain_hash='" . $domain_hash . "' AND path_hash='" . $path_hash . "' AND type='" . $get_type . "3' AND dateline > {$over_dateline}"), 0);
//3是服务端 4是本地的缓存
if ($count) {
return FALSE;
}
$args = array('get_type' => $get_type, 'url' => $url);
$rpcClient = rpcClient();
$client_info = get_client_info();
$re = $rpcClient->cloud_match_rules($args, $client_info);
if (is_object($re) || $re->Number == 0) {
if ($re->Message) {
return milu_lang('phprpc_error', array('msg' => $re->Message));
}
$re = (array) $re;
}
$data = array();
if ($re['data_type'] == 1) {
//返回规则
$rules_info = $re['data'];
if ($get_type == 3) {
$data = evo_rules_get_article($content, $rules_info);
} else {
$data = rules_get_article($content, $rules_info);
}
if ($data || $data['content'] && $get_type == 3) {
//规则验证有效,下载到本地
if ($get_type == 3) {
$data_id = import_evo_data($rules_info);
} else {
$data_id = import_fastpick_data($rules_info);
}
if ($data_id) {
//先清除之前的索引
DB::query('DELETE FROM ' . DB::table('strayer_searchindex') . " WHERE domain_hash='" . $domain_hash . "' AND path_hash='" . $path_hash . "'");
add_search_index($domain_hash, $path_hash, $get_type . '4', $data_id);
//添加索引
}
}
} else {
if ($re['data_type'] == 2) {
//返回内容
$data = $re['data'];
} else {
//一无所获,那也要告诉客户端,别再骚扰服务端了
add_search_index($domain_hash, $path_hash, $get_type . '3', 0);
}
}
return $data;
}
示例15: stripsearchkey
$searchkey = stripsearchkey($_GET['searchkey']);
$searchcate = intval($_GET['searchcate']);
$catids = category_get_childids('portal', $searchcate);
$catids[] = $searchcate;
if ($searchkey) {
$wherearr[] = "title LIKE '%{$searchkey}%'";
}
$searchkey = dhtmlspecialchars($searchkey);
if ($searchcate) {
$wherearr[] = "catid IN (" . dimplode($catids) . ")";
}
$wheresql = implode(' AND ', $wherearr);
if ($wheresql) {
$wheresql = " WHERE " . $wheresql;
}
$count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('portal_article_title') . "{$wheresql} LIMIT 50"), 0);
if ($count) {
$query = DB::query("SELECT * FROM " . DB::table('portal_article_title') . "{$wheresql} ORDER BY dateline DESC LIMIT 50");
while ($value = DB::fetch($query)) {
$articlelist[] = $value;
}
}
} elseif ($op == 'add') {
$relatedid = trim($_GET['relatedid']);
$relatedarr = explode(',', $relatedid);
$relatedarr = array_map('intval', $relatedarr);
$relatedarr = array_unique($relatedarr);
$relatedarr = array_filter($relatedarr);
if ($relatedarr) {
$query = DB::query("SELECT * FROM " . DB::table('portal_article_title') . " WHERE aid IN (" . dimplode($relatedarr) . ")");
$list = array();