本文整理匯總了PHP中db::table方法的典型用法代碼示例。如果您正苦於以下問題:PHP db::table方法的具體用法?PHP db::table怎麽用?PHP db::table使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類db
的用法示例。
在下文中一共展示了db::table方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($fields, \Classes\DB\Connection $db)
{
$this->db = $db;
$this->table = $fields['table'];
$this->tableId = isset($fields['id']) ? $fields['id'] : 'id';
$this->tableLeft = isset($fields['left']) ? $fields['left'] : 'lkey';
$this->tableRight = isset($fields['right']) ? $fields['right'] : 'rkey';
$this->tableLevel = isset($fields['level']) ? $fields['level'] : 'level';
$this->tableTree = $this->db->table($this->table, $this->pk);
}
示例2: _add
function _add()
{
$array = array('news_date' => 'NOW()', 'news_pub' => '1', 'news_title' => params::get('news_title'), 'news_content' => params::get('news_content'), 'news_desc' => params::get('news_desc'));
db::table('news');
db::smartInsert($array);
headers::app('news');
}
示例3: 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));
}
}
示例4: 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;
}
}
示例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: 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']);
}
示例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: 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);
}
}
}
}
示例12: country
function country($array = false, $rollname = 'country')
{
$country = array();
db::table('country');
$res = db::select();
while ($row = mysql_fetch_assoc($res)) {
if ($array) {
$country[$row['country_id']] = $row['country_name'];
}
s::roll($rollname, $row);
}
return $country;
}
示例13: 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'));
}
}
示例14: 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);
}
示例15: table
function table($table)
{
self::$sql = '';
self::$res = false;
self::$table = T_ . $table;
self::$columns = array();
self::$collector = array();
self::$group_by = '';
self::$order = '';
self::$join_construct = '';
self::$values = '';
self::$limit = '';
self::$last_where = false;
self::$global_index = 0;
self::$pager = false;
}