本文整理汇总了PHP中Model::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::select方法的具体用法?PHP Model::select怎么用?PHP Model::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCategoryAll
public function getCategoryAll()
{
$model = new Model();
$query = 'SELECT * FROM category';
$values = $model->select($query);
return $values;
}
示例2: active_info
public function active_info()
{
$v_id = $this->get_volun_id();
$obj = new Model('t_active');
if (empty($v_id)) {
$other_content = $obj->select();
$this->assign('other_content', $other_content);
} else {
//列出自己发布的项目
$where = 'v_id=\'' . $v_id . '\'';
$my_content = $obj->where($where)->select();
$this->assign('my_content', $my_content);
$v_g = new Model('t_volun_group');
$act = $v_g->where('volun_join_id=\'' . $v_id . '\'')->field('a_id')->select();
$arr = array();
foreach ($act as $v) {
$arr[] = $v['a_id'];
}
$str2 = implode(',', $arr);
//我参与的活动
$where = 'a_id in (' . $str2 . ')';
$my_join_content = $obj->where($where)->select();
$this->assign('my_join_content', $my_join_content);
//列出不是自己发布的项目
$where = 'v_id<>\'' . $v_id . '\'';
$other_content = $obj->where($where)->select();
$this->assign('other_content', $other_content);
}
$this->display();
}
示例3: add
public function add()
{
$where['id'] = $_GET['id'];
if ($where['id']) {
$array = $this->SelfDB->where($where)->find();
/*
if (C('web_admin_edittime')){
$array['checktime']= 'checked';
}
*/
$array['tpltitle'] = '编辑';
} else {
$array['addtime'] = time();
//$array['checktime']= 'checked';
$array['tpltitle'] = '添加';
}
$this->assign('array', $array);
//手工分类
//$m = new module('self_type');
$m = new Model('self_type');
//var_dump($m);
$select = $m->select();
$dataArr = $this->SelfDB->order('orders desc')->select();
//print_r($select);
$this->assign('typeArr', $select);
$this->assign('dataArr', $dataArr);
$this->display('./views/admin/Self_index.html');
}
示例4: index
public function index()
{
$db = new Model('user');
$select = $db->select();
$this->assign('select', $select);
$this->display();
}
示例5: findOne
public function findOne()
{
$where = array("id='{$this->R['id']}'");
if (!$this->check->checkOne($this, $where)) {
$this->check->showError();
}
return parent::select(array('id', 'price_left', 'price_right'), array('where' => $where, 'limit' => '1'));
}
示例6: findAllNav
public function findAllNav()
{
$_allPrice = parent::select(array('id', 'price_left', 'price_right'), array('order' => 'price_left ASC,price_right ASC'));
foreach ($_allPrice as $_value) {
$_value->value = $_value->price_left . ' - ' . $_value->price_right;
}
return $_allPrice;
}
示例7: findOne
public function findOne()
{
$_where = array("id='{$this->_R['id']}'");
if (!$this->_check->oneCheck($this, $_where)) {
$this->_check->error();
}
return parent::select(array('id', 'name', 'url', 'info', 'price_in', 'price_out', 'price_add'), array('where' => $_where, 'limit' => '1'));
}
示例8: ajaxTest
public function ajaxTest()
{
$Demo = new Model('Demo');
// 实例化模型类
$list = $Demo->select();
// 查询数据
$this->ajaxReturn($list, "新增错误!", 1);
}
示例9: constructBlogByID
/**
* constructs new object from database with the the id $id
*
* @param $id
* @return Blog
*/
public static function constructBlogByID($id)
{
$query = "SELECT * FROM Blog WHERE blog_id = " . intval($id);
$res = parent::select($query);
if ($res) {
return self::constructBlog($res[0]);
}
}
示例10: findOne
public function findOne()
{
$where = array("id='{$this->R['id']}'");
if (!$this->check->checkOne($this, $where)) {
$this->check->showError();
}
return parent::select(array('id', 'name', 'url', 'info', 'type'), array('where' => $where, 'limit' => '1'));
}
示例11: findOne
public function findOne()
{
$_where = array("user='{$_COOKIE['user']}' AND selected = 1");
// if(!$this->_check->oneCheck($this,$_where))
// {
// $this->_check->error();
// }
return parent::select(array('id', 'user', 'name', 'email', 'tel', 'code', 'buildings', 'address', 'flag'), array('where' => $_where, 'limit' => '1'));
}
示例12: findOne
public function findOne()
{
$_where = array("goods_id='{$this->_R['goods_id']}' AND order_id='{$this->_R['order_id']}'");
// if(!$this->_check->oneCheck($this,$_where))
// {
// $this->_check->error();
// }
return parent::select(array('star', 'content', 're_content'), array('where' => $_where, 'limit' => '1'));
}
示例13: index
public function index()
{
$m = new Model('User');
$arr = $m->select();
//print_r($arr);
$this->assign('data', $arr);
//这样可以在view页面动态的输出$data
$this->display();
}
示例14: findOne
public function findOne()
{
$where = array("user='{$_COOKIE['user']}'", "selected=1");
if (isset($this->R['id'])) {
$where = array("id='{$this->R['id']}'");
}
//if(!$this->check->checkOne($this,$where))$this->check->showError();
return parent::select(array('id', 'name', 'email', 'address', 'flag', 'tel', 'time', 'code', 'buildings'), array('where' => $where, 'limit' => '1'));
}
示例15: delete
public function delete()
{
$_where = array("id='{$this->_R['id']}'");
$_service = parent::select(array('first'), array('where' => $_where, 'limit' => '1'));
if ($_service[0]->first == 1) {
return 0;
} else {
return parent::delete($_where);
}
}