本文整理汇总了PHP中db::select方法的典型用法代码示例。如果您正苦于以下问题:PHP db::select方法的具体用法?PHP db::select怎么用?PHP db::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mostrar_usuarios
public function mostrar_usuarios()
{
$array = array();
parent::__construct($this->db, $this->tabla);
parent::select($array);
parent::mostrar_resultados();
}
示例2: __get
/**
* Overriding __get() to allow for self relations with parent_id
*
* @param mixed $key the key to return
*
* @return mixed
*/
public function __get($key)
{
if ('parent_id' == $key) {
return db::select(array_keys($this->_data))->from($this->_table_name)->where('id', '=', $this->_data['parent_id'])->as_object('Model_Category')->execute($this->_db)->current();
}
return parent::__get($key);
}
示例3: logged_in
/**
* Checks if a session is active.
*
* @param mixed role name string, role ORM object, or array with role names
* @return boolean
*/
public function logged_in($role = NULL)
{
$status = FALSE;
// Get the user from the session
$user = $this->get_user();
if (is_object($user) and $user instanceof Model_User and $user->id) {
// Everything is okay so far
$status = TRUE;
if (!empty($role)) {
// Multiple roles to check
if (is_array($role)) {
// Check each role
foreach ($role as $_role) {
if (!is_numeric($_role)) {
$_role = AutoModeler_ORM::factory('role')->load(db::select()->where('name', '=', $_role))->id;
}
// If the user doesn't have the role
if (!$user->has('roles', $_role)) {
// Set the status false and get outta here
$status = FALSE;
break;
}
}
} else {
if (!is_numeric($role)) {
// Load the role
$role = AutoModeler_ORM::factory('role')->load(db::select()->where('name', '=', $role))->id;
}
// Check that the user has the given role
$status = $user->has('roles', $role);
}
}
}
return $status;
}
示例4: siteMap
function siteMap()
{
db::table('pages');
db::where('site_id', ADMIN_SITE_ID);
db::where('page_map', '1');
db::where('page_dynamic', '0');
$res = db::select();
$content = '';
while ($row = mysql_fetch_assoc($res)) {
$content .= '
<url>
<loc>http://' . ADMIN_SITE . $row['page_folder'] . '</loc>
<lastmod>' . substr($row['page_date'], 0, 10) . '</lastmod>
</url>';
}
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . $content . '
</urlset>';
if (files::write(ROOT . '/sitemap.xml', $xml)) {
buffer::set('sitemap.xml успешно создан.');
} else {
buffer::set('Не удалось записать sitemap.xml.');
}
}
示例5: create_feed
/**
* Generate RSS 2.0 feed
*
* @return string RSS 2.0 xml
*/
public function create_feed()
{
ob_clean();
$xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
$xml .= '<rss version="2.0">' . "\n";
// channel required properties
$xml .= '<channel>' . "\n";
$xml .= '<title>test</title>' . "\n";
$xml .= '<link>test</link>' . "\n";
$xml .= '<description>test</description>' . "\n";
// channel optional properties
$db = new db();
$query = "SELECT postid, posttitle, postdescription FROM article ORDER BY postid DESC LIMIT 15";
// get RSS channel items
//$now = date("YmdHis"); // get current time // configure appropriately to your environment
$rss_items = $db->select($query);
//var_dump($rss_items);die;
foreach ($rss_items as $rss_item) {
$xml .= '<item>' . "\n";
$xml .= '<title>' . $rss_item['posttitle'] . '</title>' . "\n";
$xml .= '<description>' . $rss_item['postdescription'] . '</description>' . "\n";
/* $xml .= '<category>' . $rss_item['category'] . '</category>' . "\n";
$xml .= '<source>' . $rss_item['source'] . '</source>' . "\n";*/
$xml .= '</item>' . "\n";
}
$xml .= '</channel>';
$xml .= '</rss>';
//var_dump($xml);
return $xml;
}
示例6: get_cached
private static function get_cached($id)
{
$track_data = db::select('audio_cache', 'track_data', array('id' => $id));
if (empty($track_data)) {
return false;
}
return (array) json_decode($track_data[0]['track_data']);
}
示例7: edit
public function edit($id)
{
$db = new db();
$query = "select * from users where userid = '{$id}'";
$result = $db->select($query);
//var_dump($result);die;
return $result;
}
示例8: get_ingredientes
public function get_ingredientes()
{
$array = array();
parent::__construct($this->db, $this->tabla);
parent::select($array);
$this->resultado = parent::__get("resultado");
var_dump($this->resultado);
}
示例9: get_cached
private static function get_cached($video_id)
{
$video_data = db::select('video_cache', 'video_data', array('id' => $video_id));
if (!empty($video_data)) {
return json_decode($video_data[0]['video_data']);
} else {
return false;
}
}
示例10: getPadaliniai
public static function getPadaliniai($idParamosPriemone)
{
$result = db::select("SELECT * FROM `PPOS`.`ParamosAdministravimas` WHERE ParamosPriemone = " . $idParamosPriemone);
if ($result["bool"] == true) {
return $result["data"];
} else {
return $result;
}
}
示例11: 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;
}
}
示例12: 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'];
}
}
示例13: listar
public function listar(db $db)
{
$db->clear();
$db->setTabela('funcionarios AS A, cargos AS B');
$db->setCondicao(" A.status_funcionario in('" . status::ATIVO . "') AND A.id_cargo = B.id_cargo");
$campos = array('A.id_funcionario', 'A.codigo_funcionario', 'A.foto_funcionario', 'A.nome_funcionario', 'A.sobrenome_funcionario', 'B.nome_cargo', 'B.setor_cargo', 'A.cpf_funcionario', 'A.status_funcionario', 'A.timestamp');
if ($db->select($campos)) {
return $db->resultAll();
}
}
示例14: 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'];
}
}
示例15: 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'];
}
}