本文整理汇总了PHP中DB::get_all方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::get_all方法的具体用法?PHP DB::get_all怎么用?PHP DB::get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::get_all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tminiget
public function tminiget($pos = '')
{
global $_M;
$pos = $pos ? $pos : '0';
$posw = $pos == 'all' ? '' : " and pos='{$pos}' ";
$query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$this->no}' {$posw} AND lang='{$this->lang}' order by no_order,id ";
$this->inc = DB::get_all($query);
return $this->inc;
}
示例2: dolidb
function dolidb()
{
global $_M;
$file = $_M['form']['met_skin_user'] ? $_M['form']['met_skin_user'] : $_M['config']['met_skin_user'];
$this->checktem($file);
$tmpincfile = PATH_WEB . "templates/{$_M[form][met_skin_user]}/metinfo.inc.php";
if (file_exists($tmpincfile)) {
require $tmpincfile;
}
//列表页设置
$m_now_time = time();
$met_timetype[0] = array(1 => 'Y-m-d H:i:s', 2 => date('Y-m-d H:i:s', $m_now_time));
$met_timetype[1] = array(1 => 'Y-m-d', 2 => date('Y-m-d', $m_now_time));
$met_timetype[2] = array(1 => 'Y/m/d', 2 => date('Y/m/d', $m_now_time));
$met_timetype[3] = array(1 => 'Ymd', 2 => date('Ymd', $m_now_time));
$met_timetype[4] = array(1 => 'Y-m', 2 => date('Y-m', $m_now_time));
$met_timetype[5] = array(1 => 'Y/m', 2 => date('Y/m', $m_now_time));
$met_timetype[6] = array(1 => 'Ym', 2 => date('Ym', $m_now_time));
$met_timetype[6] = array(1 => 'm-d', 2 => date('m-d', $m_now_time));
$met_timetype[7] = array(1 => 'm/d', 2 => date('m/d', $m_now_time));
$met_timetype[8] = array(1 => 'md', 2 => date('md', $m_now_time));
$selecthtml = '';
for ($i = 0; $i < 9; $i++) {
$selecthtml .= "<option value=\"{$met_timetype[$i][1]}\">{$met_timetype[$i][2]}</option>";
}
switch ($_M['form']['listdb']) {
case 2:
//全局
$inilist = $this->iniclass->tminiment(0);
$temname = $_M[form][mobile] ? 'mobile_overall' : 'oldoverall';
break;
case 3:
//首页
$wap_ok = $_M[form][mobile] ? 1 : 0;
if ($_M[form][mobile]) {
$set = DB::get_one("select * from {$_M[table][config]} where name='flash_10001' and lang='{$_M[lang]}'");
$_M['config']['flash_10001'] = $set['mobile_value'];
}
$bannerlist = DB::get_all("select * from {$_M[table][flash]} where wap_ok='{$wap_ok}' and (module like '%,10001,%' or module = 'metinfo') and lang='{$_M[lang]}' and img_path!='' order by no_order ");
$inbaset = explode('|', $_M['config']['flash_10001']);
$inilist = $this->iniclass->tminiment(1);
$temname = $_M[form][mobile] ? 'mobile_home' : 'oldhome';
break;
case 4:
//列表页
$inilist = $this->iniclass->tminiment(2);
$temname = $_M[form][mobile] ? 'mobile_page' : 'oldpage';
break;
case 5:
//详情页
$inilist = $this->iniclass->tminiment(3);
$temname = $_M[form][mobile] ? 'mobile_details' : 'olddetails';
break;
}
require $this->template('tem/' . $temname);
}
示例3: member_information
/**
* 获取当前会员信息;
* @return array $user 返回记录当前会员信息的数组
*/
function member_information()
{
global $_M;
$metinfo_member_name = get_met_cookie('metinfo_member_name');
$user = load::sys_class('user', 'new')->get_user_by_username($metinfo_member_name);
$user['usertype'] = $user['groupid'];
$user['admin_id'] = $user['username'];
$user['admin_pass'] = $user['password'];
$query = "SELECT id,name FROM {$_M['table']['column']} WHERE access <= '{$user['groupid']}' AND lang = '{$_M['lang']}'";
$column = DB::get_all($query);
$user['column'] = $column;
return $user;
}
示例4: json_user_list
public function json_user_list()
{
global $_M;
$groupid = $_M['form']['groupid'];
$keyword = $_M['form']['keyword'];
$search = $groupid ? "and groupid = '{$groupid}'" : '';
$search .= $keyword ? "and (username like '%{$keyword}%' || email like '%{$keyword}%' || tel like '%{$keyword}%')" : '';
$table = load::sys_class('tabledata', 'new');
$order = "login_time DESC,register_time DESC";
$where = "lang='{$_M['lang']}' {$search}";
$userlist = $table->getdata($_M['table']['user'], '*', $where, $order);
$user_group = array();
$group = DB::get_all("SELECT * FROM {$_M[table][user_group]} WHERE lang = '{$_M[form][lang]}'");
foreach ($group as $key => $val) {
$user_group[$val['id']] = $val['name'];
}
foreach ($userlist as $key => $val) {
switch ($val['source']) {
case 'weixin':
$val['source'] = '微信登录';
break;
case 'weibo':
$val['source'] = '微博登录';
break;
case 'qq':
$val['source'] = 'QQ登录';
break;
default:
$val['source'] = '注册';
break;
}
if (!$val['login_time']) {
$val['login_time'] = $val['register_time'];
}
$list = array();
$list[] = "<input name=\"id\" type=\"checkbox\" value=\"{$val[id]}\">";
$list[] = $val['username'];
$list[] = $user_group[$val['groupid']];
$list[] = timeFormat($val['register_time']);
$list[] = timeFormat($val['login_time']);
$list[] = $val['login_count'];
$list[] = $val['valid'] ? '已激活' : '未激活';
$list[] = $val['source'];
$list[] = "<a href=\"{$_M[url][own_form]}a=doeditor&id={$val['id']}\" class=\"edit\">编辑</a><span class=\"line\">|</span><a href=\"{$_M[url][own_form]}a=dodellist&allid={$val['id']}\" class=\"delet\" data-confirm='{$_M[word][js7]}'>删除</a>";
$rarray[] = $list;
}
$table->rdata($rarray);
}
示例5: getdata
/**
* 获取表查询数据
* @param string $table 表名
* @param string $field 表字段
* @param string $where where条件
* @param string $order order by条件
* @return array 查询数据
*/
public function getdata($table, $field = '*', $where = '', $order = '')
{
global $_M;
/*获取表格ajax传递的参数*/
$length = $_M['form']['length'];
//每页显示数量
$start = $_M['form']['start'];
//读取数据的起点
$draw = $_M['form']['draw'];
//累计执行次数,无作用但必须回传
if ($_M['form']['tablepage'] && $start == 0 & $draw == 1) {
$cook = explode("|", $_M['form']['tablepage']);
$u = "{$_M['form']['n']},{$_M['form']['c']},{$_M['form']['a']}";
if ($cook[1] == $u) {
$start = $cook[0] * $_M['form']['length'];
}
}
/*查询表*/
if ($where) {
$conds .= " WHERE {$where} ";
}
if ($order) {
$conds .= " ORDER BY {$order} ";
}
//整理查询条件
$query = "SELECT {$field} FROM {$table} {$conds} LIMIT {$start},{$length}";
//mysql语句
$array = DB::get_all($query);
//执行查询,获得数组
$error = DB::error();
if ($error) {
$this->error = $query . "<br />" . $error;
} else {
$this->error = '';
}
$total = DB::counter($table, $conds, '*');
//获取总数量,计算总页数
/*回传数组处理*/
$this->rarray = array();
$this->rarray['draw'] = $draw;
//回传执行次数
$this->rarray['recordsTotal'] = $total;
//回传总数量
$this->rarray['recordsFiltered'] = $total;
//回传筛选过的总数量,暂无作用,但必须回传
return $array;
}
示例6: load_template_lang
/**
* 获取前台模板的语言参数配置,存放在$_M['word']中,系统语言参数数组。
*/
protected function load_template_lang()
{
global $_M;
//模板文件
$query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M[config][met_skin_user]}' AND lang='{$_M['lang']}' order by no_order ";
$inc = DB::get_all($query);
$tmpincfile = PATH_WEB . "templates/{$_M[config][met_skin_user]}/metinfo.inc.php";
require $tmpincfile;
$_M['config']['metinfover'] = $metinfover;
foreach ($inc as $key => $val) {
$name = $val['name'];
if ($val[type] == 7 && strstr($val['value'], "../upload/") && $index == 'index' && $metinfover == 'v1') {
$val['value'] = explode("../", $val['value']);
$val['value'] = $val['value'][1];
}
$_M['word'][$name] = trim($val['value']);
}
}
示例7: __construct
/**
* 初始化
*/
public function __construct()
{
global $_M;
parent::__construct();
$this->check();
$this->userclass = load::sys_class('user', 'new');
$query = "SELECT * FROM {$_M['table']['column']} WHERE module='10' AND lang='{$_M['lang']}'";
$member = DB::get_one($query);
if ($_M['config']['met_title_type'] == 0) {
$_M['tem_data']['title'] = $member['name'];
} else {
if ($_M['config']['met_title_type'] == 1) {
$_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords'];
} else {
if ($_M['config']['met_title_type'] == 2) {
$_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_webname'];
} else {
if ($_M['config']['met_title_type'] == 3) {
$_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords'] . '-' . $_M['config']['met_webname'];
}
}
}
}
$query = "SELECT * FROM {$_M['table']['ifmember_left']}";
$navigation = DB::get_all($query);
foreach ($navigation as $key => $val) {
if ($val[columnid]) {
//$column = $class_list[$val[columnid]];
$query = "SELECT * FROM {$_M['table']['column']} WHERE id = '{$val[columnid]}'";
$column = DB::get_one($query);
$val['foldername'] = $val['foldername'] ? $val['foldername'] : $column['foldername'];
$val['filename'] = $val['filename'] ? $val['filename'] : 'index.php';
$list['url'] = "../{$val['foldername']}/{$val['filename']}";
$list['title'] = $column['name'];
} else {
$list['url'] = "../{$val['foldername']}/{$val['filename']}";
$list['title'] = $val['title'];
}
$_M['html']['app_sidebar'][] = $list;
}
}
示例8: count
//$_SESSION['username'] = "sys";
//$_SESSION['password'] = md5("sys");
//$_SESSION['usrDuty'] = 1;
//$_SESSION['usrcname'] = "管理员";
//$_SESSION['personshihao'] = "";
echo "管理员";
} else {
echo "fail";
}
} else {
echo "fail";
}
}
}
if ($type == "getInterviewList") {
$result = $dbop->get_all("select interviewid, personshihao, interviewdate, shequname, xiaoquname, loufanghao, interviewrecord.loufangid from interviewrecord, shequ, xiaoqu, loufang where interviewrecord.interviewstatus='待走访' and interviewrecord.loufangid=loufang.loufangid and loufang.xiaoquid=xiaoqu.xiaoquid and shequ.shequid=xiaoqu.shequid order by interviewdate");
$count = count($result);
echo "<div class='panel-heading'><span class='badge' style='float:right'>{$count}</span>待走访一览</div>\n <ul class='list-group'>";
if ($count > 0) {
$curDay = date("Y-m-d");
foreach ($result as $i => $value) {
// 获取地址
$interviewid = $result[$i]['interviewid'];
$shequname = $result[$i]['shequname'];
$xiaoquname = $result[$i]['xiaoquname'];
$loufanghao = $result[$i]['loufanghao'];
$personshihao = $result[$i]['personshihao'];
$addr = $shequname . " > " . $xiaoquname . " > " . $loufanghao . " > " . $personshihao;
// 获取访问日期及访问日期与当前日期之差
$interviewdate = $result[$i]['interviewdate'];
$dis = ceil((strtotime($interviewdate) - strtotime($curDay)) / 86400);
示例9: export
public function export($fileName, $fileFormat, $table)
{
$content = "";
$content = "catName\n";
$db = new DB();
$result = $db->get_all($table);
while ($row = mysql_fetch_array($result)) {
$content .= $row['catName'] . "\n";
}
if ($fileFormat == 'csv') {
header("Content-Type: application/csv");
header("content-Disposition: attachment; filename=" . $fileName);
}
return $content;
}
示例10: dopos
public function dopos()
{
global $_M;
$metinfo['citylist'][0]['p']['name'] = '全局';
$metinfo['citylist'][0]['p']['value'] = 0;
$metinfo['citylist'][0]['c'][0]['n']['name'] = '首项';
$metinfo['citylist'][0]['c'][0]['n']['value'] = 0;
$metinfo['citylist'][1]['p']['name'] = '首页';
$metinfo['citylist'][1]['p']['value'] = 1;
$query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND pos = '0' ORDER BY no_order DESC,id DESC ";
$max_order = DB::get_one($query);
$max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
$metinfo['citylist'][1]['c'][0]['n']['name'] = '首项';
$metinfo['citylist'][1]['c'][0]['n']['value'] = $max_order['id'];
$metinfo['citylist'][2]['p']['name'] = '列表页';
$metinfo['citylist'][2]['p']['value'] = 2;
$query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1') ORDER BY no_order DESC,id DESC ";
$max_order = DB::get_one($query);
$max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
$metinfo['citylist'][2]['c'][0]['n']['name'] = '首项';
$metinfo['citylist'][2]['c'][0]['n']['value'] = $max_order['id'];
$metinfo['citylist'][3]['p']['name'] = '详细页';
$metinfo['citylist'][3]['p']['value'] = 3;
$query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1' OR pos='2') ORDER BY no_order DESC,id DESC ";
$max_order = DB::get_one($query);
$max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
$metinfo['citylist'][3]['c'][0]['n']['name'] = '首项';
$metinfo['citylist'][3]['c'][0]['n']['value'] = $max_order['id'];
$query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id";
$tems = DB::get_all($query);
foreach ($tems as $key => $val) {
$val['pos'] = $val['pos'];
$tem = array();
$tem['n']['name'] = $val['valueinfo'];
$tem['n']['value'] = $val['id'];
$metinfo['citylist'][$val['pos']]['c'][] = $tem;
}
echo jsonencode($metinfo);
}
示例11: all_field_query
/**
* return all possible results for a DB query for specified tables and fields
*/
protected function all_field_query($tables, $columns, $where, $fields)
{
$db_query = DB::get_all('SELECT ' . $columns . ' FROM ' . $tables . ' WHERE ' . $where, $fields);
return $db_query;
}
示例12: dousercsv
function dousercsv()
{
global $_M;
$groupid = $_M['form']['groupid'];
$keyword = $_M['form']['keyword'];
$search = $groupid ? "and groupid = '{$groupid}'" : '';
$search .= $keyword ? "and (username like '%{$keyword}%' || email like '%{$keyword}%' || tel like '%{$keyword}%')" : '';
/*查询表*/
$query = "SELECT * FROM {$_M['table']['user']} WHERE lang='{$_M['lang']}' {$search} ORDER BY login_time DESC,register_time DESC";
//mysql语句
$array = DB::get_all($query);
$paralist = $this->paraclass->get_para_list(10);
foreach ($array as $key => $val) {
switch ($val['source']) {
case 'weixin':
$val['source'] = '微信登录';
break;
case 'weibo':
$val['source'] = '微博登录';
break;
case 'qq':
$val['source'] = 'QQ登录';
break;
default:
$val['source'] = '注册';
break;
}
if (!$val['login_time']) {
$val['login_time'] = $val['register_time'];
}
$list = array();
$list[] = $val['username'];
$list[] = $user_group[$val['groupid']];
$list[] = date('Y-m-d H:i:s', $val['register_time']);
$list[] = date('Y-m-d H:i:s', $val['login_time']);
$list[] = $val['login_count'];
$list[] = $val['valid'] ? '已激活' : '未激活';
$list[] = $val['source'];
$list[] = $val['email'];
$list[] = $val['tel'];
if ($paralist) {
$para = $this->paraclass->get_para($val['id'], 10);
foreach ($paralist as $vals) {
$list[] = $para['info_' . $vals['id']];
}
}
$rarray[] = $list;
}
$filename = "USER_" . date('Y-m-d', time()) . "_ACCLOG";
$head = array('用户名', '会员组', '注册时间', '最后活跃', '登录次数', '是否激活', '来源', '绑定邮箱', '绑定手机');
if ($paralist) {
foreach ($paralist as $val) {
$head[] = $val['name'];
}
}
$csv = load::sys_class('csv', 'new');
$csv->get_csv($filename, $rarray, $head);
}
示例13: plugin
/**
* 加载插件
* @param string $plugin 需要加载的插件系统名
*/
public static function plugin($plugin, $return = 0)
{
global $_M;
if (!$_M['plugin']) {
$query = "SELECT * FROM {$_M['table']['app_plugin']} WHERE effect='1' ORDER BY no_order DESC";
$plugins = DB::get_all($query);
foreach ($plugins as $key => $val) {
$_M['plugin'][$val['m_action']][] = $val['m_name'];
}
}
foreach ($_M['plugin'][$plugin] as $key => $val) {
$own = $_M['url']['own'];
$_M['url']['own'] = $_M['url']['app'] . $val . '/';
if (file_exists(PATH_APP . 'app/' . $val . '/plugin/' . 'plugin_' . $val . '.class.php')) {
require_once PATH_APP . 'app/' . $val . '/plugin/' . 'plugin_' . $val . '.class.php';
//self::_load_class(PATH_APP.'app/'.$val.'/plugin/', 'plugin_'.$val, $plugin);
$name = 'plugin_' . $val;
if (class_exists($name)) {
$newclass = new $name();
if (method_exists($newclass, $plugin)) {
if ($return == 1) {
return call_user_func(array($newclass, $plugin));
} else {
call_user_func(array($newclass, $plugin));
}
}
}
}
$_M['url']['own'] = $own;
}
}
示例14: DB
<?php
include 'functions.php';
$db = new DB();
$table_name = 'triggers_personality';
$result = $db->get_all($table_name);
while ($row = mysql_fetch_array($result)) {
?>
<h1><?php
echo $row['name'];
?>
</h1>
<h3><?php
echo $row['position'];
?>
</h3>
<h5><?php
echo $row['desc'];
?>
</h5>
<hr>
<?php
}
示例15: get_para
public function get_para()
{
global $_M;
$query = "SELECT * FROM {$_M['table']['shopv2_para']} WHERE value!=''";
$para = DB::get_all($query);
foreach ($para as $val) {
$valuelist = explode(',', $val['valuelist']);
$paras[$val['value']] = $valuelist;
}
return $paras;
}