本文整理汇总了PHP中db::result方法的典型用法代码示例。如果您正苦于以下问题:PHP db::result方法的具体用法?PHP db::result怎么用?PHP db::result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::result方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: consultar
public function consultar(db $db, usuariosModel $usuario, $status)
{
$db->clear();
$sql = "select * from sys_usuarios as a \n\t\t\t\t\t\t inner join nivel_acesso as b on a.id_nivel_acesso = b.id_nivel_acesso\n\t\t\t\t\t\t inner join funcionarios as c on a.id_funcionario = c.id_funcionario AND c.id_funcionario = ?\n\t\t\t\t\t\t where a.status_usuario in ('" . implode("','", $status) . "')";
$db->setParameter(1, $this->funcionario->getId());
if ($db->query($sql)) {
return $db->result();
} else {
return null;
}
}
示例2: consultar
public function consultar(db $db, caixasModel $caixa)
{
$db->clear();
$db->setTabela('caixas');
$db->setCondicao("id_caixa = '" . $caixa->getId() . "'");
if ($db->select()) {
return $db->result();
} else {
return null;
}
}
示例3: consultar
public function consultar(db $db, funcionariosModel $funcionario, $status)
{
$db->clear();
$db->setTabela('funcionarios');
$db->setCondicao("id_funcionario = ? and status_funcionario in ('" . implode("','", $status) . "')");
$db->setParameter(1, $funcionario->getId());
if ($db->select()) {
return $db->result();
} else {
return null;
}
}
示例4: consultar
public function consultar(db $db, caixasModel $caixa)
{
$db->clear();
$db->setTabela('caixas');
$db->setCondicao("ip_maquina = ? ");
$db->setParameter(1, $caixa->getIp());
if ($db->select()) {
return $db->result();
} else {
return null;
}
}
示例5: query
public static function query($sql, $params = false)
{
self::connect();
self::$result = self::$conn->prepare($sql);
try {
if ($params) {
self::$result->execute($params);
} else {
self::$result->execute();
}
} catch (PDOException $e) {
//echo '<pre>'.$e->getMessage()."\n".$e;
//print_r($params);
//echo '</pre>';
}
return self::$result->rowCount();
}
示例6: db
<?php
define('ROOT', '../');
//define('HOST','localhost');
//define('USER','root');
//define('PASS','admin');
//define('DBNAME','2015_etc');
define('HOST', 'localhost');
define('USER', 'root');
define('PASS', '');
define('DBNAME', 'admin_masterapk');
//require_once( ROOT.'../wp-admin/admin.php' );
include "inc/db.php";
include "inc/lib.php";
include "inc/simple_html_dom.php";
include "inc/function_string.php";
$db = new db();
$sql = "SELECT ID, file FROM wp_posts as p, wp_downloads as d WHERE p.ID = d.post_id ORDER BY ID DESC";
$list = $db->result($sql);
foreach ($list as $rs) {
$id_com = getCom($rs->file);
$vdata['id_com'] = $id_com;
$db->update("wp_posts", $vdata, array("ID" => $rs->ID));
unset($vdata);
}
示例7: array
}
$article['related'] = array();
if ($page < 2 && $op != 'addpage') {
$query = DB::query("SELECT a.aid,a.title\n\t\t\t\tFROM " . DB::table('portal_article_related') . " r\n\t\t\t\tLEFT JOIN " . DB::table('portal_article_title') . " a ON a.aid=r.raid\n\t\t\t\tWHERE r.aid='{$aid}'");
while ($value = DB::fetch($query)) {
$article['related'][] = $value;
}
}
}
$_GET['from_id'] = empty($_GET['from_id']) ? 0 : intval($_GET['from_id']);
if ($_GET['from_idtype'] != 'blogid') {
$_GET['from_idtype'] = 'tid';
}
$idtypes = array($_GET['from_idtype'] => ' selected');
if ($_GET['from_idtype'] && $_GET['from_id']) {
$havepush = db::result(db::query("SELECT COUNT(*) FROM " . db::table('portal_article_title') . " WHERE id='{$_GET['from_id']}' AND idtype='{$_GET['from_idtype']}'"), 0);
if ($havepush) {
showmessage('article_push_invalid_repeat', '', array(), array('return' => true));
}
switch ($_GET['from_idtype']) {
case 'blogid':
$query = DB::query("SELECT b.*, bf.message FROM " . DB::table('home_blog') . " b\n\t\t\t\tLEFT JOIN " . DB::table('home_blogfield') . " bf ON bf.blogid=b.blogid\n\t\t\t\tWHERE b.blogid='{$_GET['from_id']}'");
if ($blog = DB::fetch($query)) {
if ($blog['friend']) {
showmessage('article_push_invalid_private');
}
$article['title'] = getstr($blog['subject'], 0);
$article['summary'] = portalcp_get_summary($blog['message']);
$article_content['content'] = dhtmlspecialchars($blog['message']);
}
break;
示例8: timezone_diff_get
function timezone_diff_get($params = array())
{
if (isset($params['sensor']) && !is_numeric($params['sensor'])) {
return false;
}
$sensor = sensor_get($params['sensor']);
date_default_timezone_set('UTC');
if (isset($sensor[$params['sensor']]['measure_timezone_diff']) && is_numeric($sensor[$params['sensor']]['measure_timezone_diff']) && $sensor[$params['sensor']]['measure_timezone_diff'] >= 1) {
if (isset($params['debug'])) {
debug('Found timezone settings in sensor in timezone_diff_get', $sensor[$params['sensor']]);
}
$timezone_diff = $sensor[$params['sensor']]['measure_timezone_diff'];
} else {
$db = new db();
$r = array();
$db->query("SELECT * FROM measure_system WHERE measure_system_setting_name = 'global_timezone_use'");
$d = $db->result();
if (isset($params['debug'])) {
debug('No timezone settings in sensor. Search global timezone settings in db in timezone_diff_get', $d);
}
$timezone_diff = $d['measure_system_setting_value'];
}
if (!isset($timezone_diff) || $timezone_diff == 0) {
if (isset($params['debug'])) {
debug('Found no timezone settings in timezone_diff_get', $timezone_diff);
}
return false;
}
preg_match('/(-)?(.+)/', $timezone_diff, $r);
$diff['prefix'] = $r[1] != '' ? $r[1] : false;
$diff['diff'] = $r[2] * 60 * 60;
return $diff;
}
示例9: exit
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: spacecp_upload.php 10707 2010-05-14 02:36:45Z zhengqingpeng $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$albumid = empty($_GET['albumid']) ? 0 : intval($_GET['albumid']);
if ($_GET['op'] == 'recount') {
$newsize = db::result(db::query("SELECT SUM(size) FROM " . db::table('home_pic') . " WHERE uid='{$_G['uid']}'"), 0);
db::update('common_member_count', array('attachsize' => $newsize), array('uid' => $_G['uid']));
showmessage('do_success', 'home.php?mod=spacecp&ac=upload');
}
if (submitcheck('albumsubmit')) {
if ($_POST['albumop'] == 'creatalbum') {
$_POST['albumname'] = empty($_POST['albumname']) ? '' : getstr($_POST['albumname'], 50, 1, 1);
if (empty($_POST['albumname'])) {
$_POST['albumname'] = gmdate('Ymd');
}
$_POST['friend'] = intval($_POST['friend']);
$_POST['target_ids'] = '';
if ($_POST['friend'] == 2) {
$uids = array();
$names = empty($_POST['target_names']) ? array() : explode(' ', str_replace(array(lang('spacecp', 'tab_space'), "\r\n", "\n", "\r"), ' ', $_POST['target_names']));
if ($names) {
$query = DB::query("SELECT uid FROM " . DB::table('common_member') . " WHERE username IN (" . dimplode($names) . ")");
while ($value = DB::fetch($query)) {
示例10: ckstart
ckstart($start, $perpage);
if ($id > 0) {
$query = DB::query("SELECT * FROM " . DB::table('home_album') . " WHERE albumid='{$id}' AND uid='{$space['uid']}' LIMIT 1");
$album = DB::fetch($query);
if (empty($album)) {
showmessage('to_view_the_photo_does_not_exist');
}
ckfriend_album($album);
$wheresql = "albumid='{$id}'";
$count = $album['picnum'];
if (empty($count) && !$space['self']) {
DB::query("DELETE FROM " . DB::table('home_album') . " WHERE albumid='{$id}'");
showmessage('to_view_the_photo_does_not_exist', "home.php?mod=space&uid={$album['uid']}&do=album&view=me");
}
if ($album['catid']) {
$album['catname'] = db::result(db::query("SELECT catname FROM " . db::table('home_album_category') . " WHERE catid='{$album['catid']}'"), 0);
}
} else {
$wheresql = "albumid='0' AND uid='{$space['uid']}'";
$count = getcount('home_pic', array('albumid' => 0, 'uid' => $space['uid']));
$album = array('uid' => $space['uid'], 'albumid' => -1, 'albumname' => lang('space', 'default_albumname'), 'picnum' => $count);
}
$albumlist = array();
$maxalbum = $nowalbum = $key = 0;
$query = DB::query("SELECT * FROM " . DB::table('home_album') . " WHERE uid='{$space['uid']}' ORDER BY updatetime DESC LIMIT 0, 100");
while ($value = DB::fetch($query)) {
if ($value['friend'] != 4 && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
$value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
} elseif ($value['picnum']) {
$value['pic'] = STATICURL . 'image/common/nopublish.gif';
} else {