本文整理汇总了PHP中db::where方法的典型用法代码示例。如果您正苦于以下问题:PHP db::where方法的具体用法?PHP db::where怎么用?PHP db::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newPassword
function newPassword($new_pass)
{
if (!empty($new_pass)) {
db::table('admin_users');
db::where('user_id', ADMIN_USER_ID);
db::update('user_password', md5($new_pass));
}
}
示例2: load
function load()
{
db::table('mails');
db::where('site_id', SITE_ID);
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
self::$mails[$row['mail_name']] = $row;
}
}
示例3: delete
function delete($log_id)
{
db::table('admin_log_trash');
db::where('log_id', $log_id);
db::delete();
@unlink(SYS_ROOT . 'var/trash/' . $log_id . '_conf.zip');
@unlink(SYS_ROOT . 'var/trash/' . $log_id . '_base.zip');
@unlink(SYS_ROOT . 'var/trash/' . $log_id . '_files.zip');
}
示例4: getFile
function getFile()
{
$file_id = params::get('file');
$dir = FILES_ROOT . 'pages/';
db::table('pages_files');
db::where('file_id', $file_id);
$file = db::assoc();
$link = $dir . $file_id . '.' . $file['file_type'];
files::downloadFile($link, $file['file_name'] . '.' . $file['file_type']);
}
示例5: update
function update($name, $value, $user_id = false)
{
if (!$user_id) {
$user_id = ADMIN_USER_ID;
}
db::table('admin_users');
db::where('user_id', $user_id);
db::update($name, $value);
}
示例6: edit
function edit()
{
events::observe('save', 'news', 'save');
events::observer();
admin::components('validator', 'redactor');
db::table('news');
db::where('news_id', admin::get('id'));
$row = db::assoc();
f::set($row);
}
示例7: loadTmpls
function loadTmpls($site_id = 1)
{
db::table('templates');
db::where('site_id', $site_id);
db::where('tmpl_pub', '1');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
self::$tmpls[$row['tmpl_id']] = $row['tmpl_name'];
}
}
示例8: loadMenus
function loadMenus($site_id)
{
db::table('menus');
db::where('site_id', $site_id);
db::where('menu_pub', '1');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
self::$menus[$row['menu_id']] = $row['menu_name'];
}
}
示例9: loadBlocks
function loadBlocks($site_id = 1)
{
db::table('blocks');
db::where('site_id', $site_id);
db::where('block_pub', '1');
$res = db::select('block_id', 'block_title', 'block_name', 'block_pub');
while ($row = mysql_fetch_assoc($res)) {
self::$blocks[$row['block_id']] = $row['block_name'];
}
}
示例10: show
function show()
{
$dir = IMAGES_PATH . 'index/';
db::table('images');
db::where('img_set', '1');
db::orderByRand();
$img = db::assoc();
if (db::rows() != 0) {
$file = $dir . $img['img_id'] . '.jpg';
buffer::set('<img src="' . $file . '" width="700" height="360" alt="" />');
}
}
示例11: download
function download()
{
$file_id = params::get('file');
db::table('files');
db::where('file_id', $file_id);
$file = db::assoc();
if (db::rows() == 0) {
web::error404();
}
$file_link = FILES_ROOT . 'all/' . $file_id . '.' . $file['file_type'];
files::downloadFile($file_link);
}
示例12: show
function show()
{
$event = web::getEvent();
if ($event === false) {
$year = date('Y');
} else {
$year = $event;
}
s::set('info_date_select', htmlspecialchars($year));
$sql = "SELECT `section_year` as date FROM `info_sections` WHERE `section_view`='0' GROUP BY `date` ORDER BY `date` DESC";
$res = db::query($sql);
$rows = mysql_num_rows($res);
if ($rows > 1) {
s::add('info_date_selector', '<ul class="years">');
while ($row = mysql_fetch_assoc($res)) {
if ($row['date'] == $year) {
$row['date'] = '<li><span>' . $row['date'] . '</span></li>';
} else {
$row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>';
}
s::add('info_date_selector', $row['date']);
}
s::add('info_date_selector', '</ul>');
}
$files = array();
db::table('info_files');
$r = db::select();
while ($a = mysql_fetch_assoc($r)) {
$files[$a['section_id']][] = $a;
}
db::table('info_sections');
db::order('section_order', 'DESC');
db::where('section_year', $year);
$r = db::select();
if (db::rows() == 0) {
web::error404();
}
while ($a = mysql_fetch_assoc($r)) {
if ($a['section_view'] == '0') {
s::roll('sections', $a);
} else {
s::roll('sections_view', $a);
}
if (isset($files[$a['section_id']])) {
foreach ($files[$a['section_id']] as $v) {
$v['file_icon'] = files::getFileIco($v['file_type']);
$v['file_size'] = files::parseSizeSmart($v['file_size']);
s::roll('items' . $a['section_id'], $v);
}
}
}
}
示例13: showOne
function showOne()
{
$news_id = web::getThis();
db::table('news');
db::where('news_pub', '1');
$news = db::assoc();
if (db::rows() == 0) {
web::error404();
}
$news['news_date'] = dt::date2print('%d %F %Y', $news['news_date']);
s::set('page_title', $news['news_title']);
s::set('page_header', $news['news_title']);
s::set($news);
}
示例14: start
function start()
{
db::connect();
if (!router::get(1)) {
return true;
}
self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2), 'id' => router::get(4));
s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
define('APP', APPS . self::get('app') . '/');
s::set('APP', APP);
define('MODULE', APP . self::get('module') . '/');
s::set('MODULE', MODULE);
if (stristr(self::$map['mode'], 'admin')) {
self::$map['mode'] = 'admin';
} else {
self::$map['mode'] = 'web';
}
if (self::$map['mode'] == 'admin') {
if (defined('ADMIN_USER_SITE_ID')) {
admin::observer();
define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
db::table('admin_sites');
db::where('site_id', ADMIN_USER_SITE_ID);
db::limit(1);
$row = db::select();
define('ADMIN_SITE', db::get('site_domain'));
s::set('ADMIN_SITE', ADMIN_SITE);
}
} else {
web::getSite();
$lang = lang::gets(LANG_INDEX, SITE_ID);
/*
Authentification webUser
*/
web::observer();
}
/*
Set params
*/
params::send();
if (router::get(0) == 'feed' || router::get(0) == 'rss') {
self::$map['module'] = 'feed';
}
if (self::$map['mode'] == 'admin') {
load::module(self::get('app'), self::get('module'), self::get('action'));
} else {
load::handler(self::get('app'), self::get('module'), self::get('action'));
}
}
示例15: restore
function restore()
{
db::table('admin_log_trash');
db::where('log_id', params::get('log_id'));
$date = date('Y-m-d H:i:s');
db::update('log_restored', $date);
db::table('admin_log_trash');
db::where('log_id', params::get('log_id'));
$row = db::assoc();
if ($row['log_tmpl'] == '1') {
trash::restore(params::get('log_id'), SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/');
} else {
trash::restore(params::get('log_id'));
}
buffer::set(dt::date2print('%H:%i:%s<br />%d %F %y', $date));
}