本文整理汇总了PHP中db::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP db::fetch方法的具体用法?PHP db::fetch怎么用?PHP db::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tujuanDes
function tujuanDes($destkota, $stat = 'provinsi', $tambah)
{
global $app;
$dbu = new db();
$appx = new app();
$urlx = new url();
if ($stat == "destinasi") {
while ($desty = $dbu->fetch($destkota)) {
$destinasi = $desty[nama];
$desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
$desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
$outnya .= '<li>
<div class="img_box">
<img src="' . $desty[thumb] . '">
</div>
<div class="text">
<h1>' . $destinasi . '</h1>
<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>
</div>
<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
</li>';
}
} elseif ($stat == "provinsi") {
while ($desty = $dbu->fetch($destkota)) {
$destinasi = $desty[nama];
$desty[thumb] = $appx->cekFile("/destinasi/thumb/", $desty[thumb], 'default.jpg');
$desty[thumb] = $app[data_www] . "/destinasi/thumb/" . $desty[thumb];
$outnya .= '<li>
<div class="img_box">
<img src="' . $desty[thumb] . '">
</div>
<div class="text">
<h1>' . $destinasi . '</h1>
<p>' . $dbu->lookup('deskripsi', $app[table][destinasi_bahasa], "id_reff ='" . $desty[id_reff] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>
</div>
<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($destinasi) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
</li>';
}
} else {
//echo "sedel";exit;
while ($dkota = $dbu->fetch($destkota)) {
$dkota[thumb] = $appx->cekFile("/kota/thumb/", $dkota[thumb], 'default.jpg');
$dkota[thumb] = $app[data_www] . "/kota/thumb/" . $dkota[thumb];
//echo "asdasdas".$dkota[thumb];
$outnya .= '<li>
<div class="img_box">
<img src="' . $dkota[thumb] . '">
</div>
<div class="text">
<h1>' . $dkota[nama] . '</h1>
<p>' . $dbu->lookup('deskripsi', $app[table][kota_bahasa], "id_kota ='" . $dkota[id] . "' AND id_bahasa='" . $_SESSION[bhs] . "'") . '</p>
</div>
<a href="' . $app[www] . "/" . $dbu->lookup('nama', 'action', "action='2' and id_bahasa='" . $_SESSION[bhs] . "'") . "/id_" . $urlx->shortLink($dkota[nama]) . "_" . $urlx->shortLink($tambah) . "/" . '"><div class="explore">EXPLORE MORE</div></a>
</li>';
}
}
return $outnya;
}
示例2: username
function username($id)
{
$username = new db();
$username->query("select name from accounts where id = '{$id}'");
$username->fetch();
return $username->element("name");
}
示例3: Ajar
/**
* Returns a slightly opened tree from an element with number $nodeId.
*
* @param integer $nodeId Node unique id
* @param string|array $fields Fields to be selected
* @param string|array $condition array key - condition (AND, OR, etc), value - condition string
* @return array Needed fields
* @throws USER_Exception
*/
function Ajar($nodeId, $fields = '*', $condition = '')
{
$condition = $this->PrepareCondition($condition, false, 'A.');
$sql = 'SELECT A.' . $this->tableLeft . ', A.' . $this->tableRight . ', A.' . $this->tableLevel . ' ';
$sql .= 'FROM ' . $this->table . ' A, ' . $this->table . ' B ';
$sql .= 'WHERE B.' . $this->tableId . ' = ' . $nodeId . ' ';
$sql .= 'AND B.' . $this->tableLeft . ' BETWEEN A.' . $this->tableLeft . ' ';
$sql .= 'AND A.' . $this->tableRight;
$sql .= $condition;
$sql .= ' ORDER BY A.' . $this->tableLeft;
$res = $this->db->query($sql);
if (0 == $this->db->numRows($res)) {
throw new USER_Exception(DBTREE_NO_ELEMENT, 0);
}
$alen = $this->db->numRows($res);
$i = 0;
$fields = $this->PrepareSelectFields($fields, 'A');
$sql = 'SELECT A.' . $this->tableId . ', A.' . $this->tableLeft . ', A.' . $this->tableRight . ', A.' . $this->tableLevel . ', ' . $fields . ' ';
$sql .= 'FROM ' . $this->table . ' A ';
$sql .= 'WHERE (' . $this->tableLevel . ' = 1';
while ($row = $this->db->fetch($res)) {
if (++$i == $alen && $row[$this->tableLeft] + 1 == $row[$this->tableRight]) {
break;
}
$sql .= ' OR (' . $this->tableLevel . ' = ' . ($row[$this->tableLevel] + 1) . ' AND ' . $this->tableLeft . ' > ' . $row[$this->tableLeft] . ' AND ' . $this->tableRight . ' < ' . $row[$this->tableRight] . ')';
}
$sql .= ') ' . $condition;
$sql .= ' ORDER BY ' . $this->tableLeft;
$result = $this->db->getInd($this->tableId, $sql);
return $result;
}
示例4: getSector
public static function getSector($x, $y)
{
global $db;
$result = $db->query('select * from grid where x="' . $x . '" and y="' . $y . '"');
$sector = db::fetch($result);
return $sector;
}
示例5: get
public static function get($type)
{
global $db;
$result = $db->query('select * from blacklist where type="' . $type . '"');
$blacklist = array();
for ($i = 0; $row = db::fetch($result); $i++) {
$blacklist[$i] = $row;
}
return $blacklist;
}
示例6: f2
function f2()
{
$db = new db();
$obj = $db->async_query('select sleep(1)');
echo "f2 async_query\n";
(yield $obj);
$row = $db->fetch();
echo "f2 fetch\n";
(yield $row);
}
示例7: feedCheckIn
function feedCheckIn($dfeed, $sBahasa, $member)
{
global $app;
$appx = new app();
$dbu = new db();
$urlx = new url();
$fcek_in = "";
$icon = $app[css_www] . "/images/ic_cat_2.png";
$avatar = $appx->cekFile('/pengguna/avatar/', $member[avatar], 'default.jpg');
$avatar = $app[data_www] . '/pengguna/avatar/' . $avatar;
$linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($member[username]) . "/";
$fcek_in = '<div class="con_newsfeed add_fix">
<div class="line_newsfeed">
<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
<div class="bar"></div>
<div class="ic_cat"><a href="#"><img src="' . $icon . '"></a></div>
</div>';
$dipost = $appx->time_delta('now', $dfeed[tgl_post], 0, 2, true);
if ($_SESSION[member][id] != "") {
$bolehKomen = '<li>
<div class="circle_pict circle_pict_nf"><a href="' . $linkAva . '"><img src="' . $avatar . '"></a></div>
<textarea id="cekin" placeholder="Write your comment..."></textarea>
</li>';
}
$sql = "SELECT a.nama , b.nama as kota , c.nama as provinsi, d.nama as negara FROM " . $app[table][destinasi_bahasa] . " as a LEFT JOIN " . $app[table][destinasi] . " as e ON (a.id_reff = e.id_reff) LEFT JOIN " . $app[table][kota] . " as b ON(e.id_kota = b.id) LEFT JOIN " . $app[table][provinsi] . " as c ON(b.id_provinsi = c.id) LEFT JOIN " . $app[table][negara] . " as d ON(c.id_negara = d.id) LEFT JOIN " . $app[table][cekin] . " as f ON(e.id = f.id_destinasi ) LEFT JOIN " . $app[table][pengguna_feed] . " as g ON(f.id = g.id_tabel) WHERE g.id ='" . $dfeed[id] . "' AND a.id_bahasa ='" . $sBahasa . "'";
$lokasi = $dbu->get_recordmix($sql);
$cekin_di = '<span>Check in at <a href="#"><i>' . $lokasi[nama] . '(' . $lokasi[kota] . '), ' . $lokasi[provinsi] . ', ' . $lokasi[negara] . '</i></a></span>';
$fcek_in .= '<div class="box_con_newsfeed">
<h1>' . $member[nama] . '</h1>
<span>' . $dipost . '</span>
<div class="frame_post">
' . $cekin_di . '
<div class="box_comment">
<ul class="add_fix" id="list_cekin" rel="cekin_' . $dfeed[id_tabel] . '">
' . $bolehKomen;
#komen cekin---------------------------
$sql = "SELECT a.nama , a.avatar, a.username, b.id, b.komen, b.tgl_post as tgl_komen FROM " . $app[table][pengguna] . " as a LEFT JOIN " . $app[table][cekin_komen] . " as b ON(b.id_user = a.id) WHERE b.id_cekin = '" . $dfeed[id_tabel] . "'";
$dbu->query($sql, $rkomen, $nkomen);
if ($nkomen > 0) {
while ($dkomen = $dbu->fetch($rkomen)) {
$dkomen[avatar] = $appx->cekFile("/pengguna/avatar/", $dkomen[avatar]);
$other_avatar = $app[data_www] . '/pengguna/avatar/' . $dkomen[avatar];
$other_linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $sBahasa . "'") . "/" . $urlx->shortLink($dkomen[username]) . "/";
$fcek_in .= '<li>
<div class="circle_pict circle_pict_nf"><a href="' . $other_linkAva . '"><img src="' . $other_avatar . '"></a></div>
<div class="text_box_c">
<h1>' . $dkomen[nama] . '</h1>
<p>' . $dkomen[komen] . '</p>
</div>
</li>';
}
}
$fcek_in .= '</ul></div></div></div></div>';
return $fcek_in;
}
示例8: get
public function get($user)
{
global $db;
$result = $db->query('select * from activations where user="' . $user . '"');
$this->data = db::fetch($result);
if (isset($this->data['user'])) {
$status = 'done';
} else {
$status = 'noActivation';
}
return $status;
}
示例9: MailQueue
function MailQueue()
{
$msg_config = jconf::get('mail_msg');
$site_url = $this->Config['site_url'];
$site_name = $this->Config['site_name'];
$page_url = 'admin.php?mod=notice&code=mailq';
$per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
$count = DB::result_first(" select count(*) from `" . TABLE_PREFIX . "mailqueue` ");
$page_arr = page($count, $per_page_num, $page_url, array('return' => 'array'), '20 50 100 200 500');
$sql = " select mq.*,m.username,m.nickname\r\n\t\t\t\t from `" . TABLE_PREFIX . "mailqueue` mq\r\n\t\t\t\t left join `" . TABLE_PREFIX . "members` m on m.uid = mq.uid\r\n\t\t\t\t where `dateline` > 0\r\n\t\t\t\t order by `dateline` {$page_arr['limit']}";
$query = DB::query($sql);
while ($rs = db::fetch($query)) {
$msg = array();
$rs['dateline'] = date('Y-m-d H:i:s', $rs['dateline']);
if ($rs['msg']) {
$nickname = $rs['nickname'];
$msg = unserialize($rs['msg']);
$site_new_data = array();
$newpm = $msg['newpm'] ? $msg['newpm'] : 0;
$newpm && ($site_new_data['newpm'] = "有{$newpm}条未读私信");
$at_new = $msg['at_new'] ? $msg['at_new'] : 0;
$at_new && ($site_new_data['at_new'] = "被@{$at_new}次");
$comment_new = $msg['comment_new'] ? $msg['comment_new'] : 0;
$comment_new && ($site_new_data['comment_new'] = "被评论{$comment_new}次");
$event_new = $msg['event_new'] ? $msg['event_new'] : 0;
$event_new && ($site_new_data['event_new'] = "有{$event_new}个活动更新");
$fans_new = $msg['fans_new'] ? $msg['fans_new'] : 0;
$fans_new && ($site_new_data['fans_new'] = "新增加{$fans_new}个粉丝");
$qun_new = $msg['qun_new'] ? $msg['qun_new'] : 0;
$qun_new && ($site_new_data['qun_new'] = "有{$qun_new}个群更新");
$vote_new = $msg['vote_new'] ? $msg['vote_new'] : 0;
$vote_new && ($site_new_data['vote_new'] = "投票有{$vote_new}个更新");
$dig_new = $msg['dig_new'] ? $msg['dig_new'] : 0;
$dig_new && ($site_new_data['dig_new'] = "被赞{$dig_new}次");
$channel_new = $msg['channel_new'] ? $msg['channel_new'] : 0;
$channel_new && ($site_new_data['channel_new'] = "频道有{$channel_new}个更新");
$company_new = $msg['company_new'] ? $msg['company_new'] : 0;
$company_new && ($site_new_data['company_new'] = "单位有{$company_new}个更新");
$load = $msg['load'] ? $msg['load'] . "天" : '';
$site_new_data = $site_new_data ? '<br>您' . implode(',', $site_new_data) . '。' : '';
if ($msg_config['msg']) {
$message = $msg_config['msg'];
$message = str_replace(array('newpm', 'at_new', 'comment_new', 'event_new', 'fans_new', 'qun_new', 'vote_new', 'dig_new', 'channel_new', 'company_new', 'load', 'site_url', 'site_name', 'time', 'nickname', 'site_new_data', 'time'), array($newpm, $at_new, $comment_new, $event_new, $fans_new, $qun_new, $vote_new, $dig_new, $channel_new, $company_new, $load, $site_url, $site_name, date('Y:m:d H:i:s'), $nickname, $site_new_data, $time), $message);
} else {
$message = "尊敬的{$nickname:}<br>您好!<br>在未登录{$site_name}的{$load}期间,您收到了一些信息:" . "{$site_new_data}<br>点击<a href='{$site_url}'>{$site_url}</a>查看" . "<br><br>(<font color='gray'>如此邮件提醒对您产生了干扰,请<a href='{$site_url}/index.php?mod=settings&code=sendmail' targegt='_blank'>点击修改提醒设置</a></font>)<br>" . data('Y-m-d H:i:s');
}
$message .= $recommend_tips ? '<br><br><b>官方推荐内容:</b>' . $recommend_tips : '';
$rs['message'] = $message;
}
$mailQueue[$rs['qid']] = $rs;
}
include template('admin/mail_queue');
}
示例10: get
public static function get($index)
{
global $db;
$result = $db->query('select * from flags');
$flags = array();
if ($index == 'name') {
while ($row = db::fetch($result)) {
$flags[$row['name']] = $row['value'];
}
} else {
for ($i = 0; $row = db::fetch($result); $i++) {
$flags[$i] = $row;
}
}
return $flags;
}
示例11: run
function run($query, $param, $action = '', $db = null)
{
$response = false;
$db = new db(null, $db);
$db->query($query);
$db->execute($param);
switch ($action) {
case 'fetch':
$response = $db->fetch();
break;
case 'update':
$response = $db;
break;
case 'insert':
$response = $db->lastInsertId();
break;
default:
$response = $db->fetchset();
break;
}
return $response;
}
示例12: __autoload
<?php
function __autoload($classname)
{
if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/object/" . $classname . ".php")) {
} else {
if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/static/" . $classname . ".php")) {
} else {
if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/form/" . $classname . ".php")) {
} else {
echo '<pre><p>Class not found ' . $classname . '</p><p>' . print_r(debug_backtrace(), 1) . '</p></pre>';
}
}
}
include_once $filename;
}
\db::connect();
$res = \db::query('SELECT DISTINCT(mid) FROM glider');
$insert_statement = \db::prepare('INSERT INTO manufacturer SET title=:title');
$update_statement = \db::prepare('UPDATE glider SET manufacturer =:mid WHERE manufacturer = :title');
while ($row = \db::fetch($res)) {
$insert_statement->execute(array('title' => $row->manufacturer));
$id = \db::insert_id();
$update_statement->execute(array('title' => $row->manufacturer, 'mid' => $id));
}
示例13: json_encode
$dbu->connect();
$appx->load_lib('url');
$uly = new url();
//Get our locations from the database.
$radius = 20;
// Search the rows in the markers table
$kat = "";
if ($_POST[kate] != "") {
$kat = "WHERE a.id_kat ='" . $_POST[kate] . "'";
}
$lat = $_POST[lat];
$lng = $_POST[lng];
//$alamat = $_POST[alamat];
$urlnya = $dbu->lookup('nama', 'action', "action='21' and id_bahasa='" . $_SESSION[bhs] . "'");
$query = "SELECT distinct a.website, b.nama as dest,a.id_kat, b.slogan, b.alamat, a.pos_lat as lat , a.pos_long as lng, ( 3959 * acos( cos( radians('" . $lat . "') ) * cos( radians( a.pos_lat ) ) * cos( radians( a.pos_long ) - radians('" . $lng . "') ) + sin( radians('" . $lat . "') ) * sin( radians( a.pos_lat ) ) ) ) AS distance, a.thumb, a.icon_map ,LTRIM(' url') as urlc FROM " . $app[table][destinasi] . " as a LEFT JOIN " . $app[table][destinasi_bahasa] . " as b ON(a.id_reff = b.id_reff) " . $kat . " HAVING distance < '" . $radius . "' ORDER BY distance asc";
$dbu->query($query, $rnear, $hit_near);
$dnear = "";
if ($hit_near > 0) {
$hit = 0;
while ($nea = $dbu->fetch($rnear)) {
$nea[urlc] = $app[www] . "/" . $urlnya . "/" . $uly->shortLink($nea[dest]) . "/";
$nea[thumb] = $appx->cekFile('/destinasi/thumb/', $nea[thumb], 'default.jpg');
$nea[thumb] = $app[data_www] . '/destinasi/thumb/' . $nea[thumb];
$nea[icon_map] = $appx->cekFile('/destinasi/icon/', $nea[icon_map], 'default.png');
$nea[icon_map] = $app[data_www] . '/destinasi/icon/' . $nea[icon_map];
$dnear[$hit] = $nea;
$hit++;
}
}
header('Content-Type: application/json');
echo json_encode($dnear);
示例14: app
$appx = new app();
$urlx = new url();
if ($id_related != "") {
// AND $dnews[id_reff]!=0
$sql = "SELECT a.id, b.username , c.judul, c.thumb FROM " . $app[table][berita] . " as a LEFT JOIN " . $app[table][pengguna] . " as b ON (a.id_user = b.id) LEFT JOIN " . $app[table][berita_bahasa] . " as c ON (c.id_berita = a.id) WHERE a.id_reff='" . $id_related . "' AND a.ket_id ='" . $tabel . "' AND a.id <> '" . $idnya . "' ORDER BY a.tgl_post DESC LIMIT 5 ";
//echo $sql;exit;
$dbu->query($sql, $rsnews, $hit_related);
}
if ($hit_related > 0) {
?>
<div class="thread related_news">
<h1 class="main_title" style="padding: 15px 15px 7px;">RELATED NEWS<span class="border"></span></h1>
<ul>
<?php
while ($dtnews = $dbu->fetch($rsnews)) {
$dtnews[thumb] = $appx->cekFile('/berita/thumb/', $dtnews[thumb], 'default.jpg');
$dtnews[thumb] = $app[data_www] . "/berita/thumb/" . $dtnews[thumb];
$linkAva = $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='8' and id_bahasa ='" . $_SESSION[bhs] . "'") . "/" . $urlx->shortLink($dtnews[username]) . "/";
?>
<li>
<a href="<?php
echo $app["www"] . "/" . $dbu->lookup('nama', 'action', "action='51'") . "/" . $urlx->shortLink($dtnews[judul]) . "_" . $dtnews[id] . "/";
?>
">
<div class="thumb_img"><img src="<?php
echo $dtnews[thumb];
?>
" width="97" height="84"></div>
<span><?php
echo $dtnews[judul];
示例15: db
<fieldset><legend>預約單</legend>
<table border=2>
<tr><th><a href=".?sort=0">預約單編號</a></th><th><a href=".?sort=1">使用日期</a><br>(年/月/日)</th><th>使用時段</th><th>會議室編號</th><th>借用人</th><th></th></tr>
<?php
$A = new db();
$B = new db();
switch (get("sort")) {
case 0:
$A->query("select * from reserves where name='" . getsession("id") . "' order by serial") ?: $A->error();
break;
case 1:
$A->query("select * from reserves where name='" . getsession('id') . "' order by date") ?: $A->error();
break;
}
if ($A->count() > 0) {
while ($A->fetch()) {
?>
<tr>
<td><?php
echo $A->element("serial");
?>
</td>
<td><?php
echo str_replace("-", "/", $A->element("date"));
?>
</td>
<td><?php
echo section($A->element("section"));
?>
</td>
<td><?php