本文整理汇总了PHP中MY_Model::table_name方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Model::table_name方法的具体用法?PHP MY_Model::table_name怎么用?PHP MY_Model::table_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Model
的用法示例。
在下文中一共展示了MY_Model::table_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_type
public function get_type($field, $value)
{
return $this->db->select(parent::table_name() . '.*')->select(STREAMS_TABLE . '.stream_name, ' . STREAMS_TABLE . '.stream_slug, ' . STREAMS_TABLE . '.stream_namespace, ' . STREAMS_TABLE . '.about')->select('(SELECT COUNT(*) FROM ' . $this->db->dbprefix('calendar') . ' WHERE item_type = ' . $this->db->dbprefix('calendar_item_types') . '.id ) AS total_items')->join(STREAMS_TABLE, 'stream_id = ' . STREAMS_TABLE . '.id', 'left')->where($field, $value)->limit(1)->get(parent::table_name())->row();
}
示例2: get_categories
public function get_categories()
{
return $this->db->select('*')->select('(SELECT COUNT(*) FROM ' . $this->db->dbprefix('calendar') . ' WHERE category = ' . $this->db->dbprefix('calendar_categories') . '.id ) AS total_items')->order_by('name', 'ASC')->get(parent::table_name())->result();
}
示例3: entries
public function entries($start = null, $end = null, $categories = false)
{
if ($start != null && $end != null) {
$sql = " SELECT " . parent::table_name() . ".*,\n " . $this->db->dbprefix('calendar_item_types') . ".stream_id, " . $this->db->dbprefix('calendar_item_types') . ".admin_layout,\n " . $this->db->dbprefix('calendar_categories') . ".item_color\n FROM " . parent::table_name() . "\n LEFT JOIN " . $this->db->dbprefix('calendar_item_types') . " ON item_type = " . $this->db->dbprefix('calendar_item_types') . ".id\n LEFT JOIN " . $this->db->dbprefix('calendar_categories') . " ON category = " . $this->db->dbprefix('calendar_categories') . ".id\n WHERE (\n (DATE_FORMAT(date_start, '%Y-%m-%d') >= '" . date('Y-m-d', $start) . "' AND DATE_FORMAT(date_end, '%Y-%m-%d') <= '" . date('Y-m-d', $end) . "' AND recurrence = 'once')\n OR (DATE_FORMAT(date_start, '%Y-%m-%d') <= '" . date('Y-m-d', $end) . "' AND recurrence <> 'once')\n )\n " . ($categories !== false ? 'AND category IN (\'' . @implode("', '", $categories) . '\')' : '') . "\n ";
return $this->db->query($sql)->result();
}
return null;
}