本文整理汇总了PHP中Tree::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::fetchAll方法的具体用法?PHP Tree::fetchAll怎么用?PHP Tree::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::fetchAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSearch
function doSearch()
{
$keyword = $_REQUEST['keyword'];
$filter_keyword = '%' . $keyword . '%';
$page_num = $_REQUEST['page_num'] ? $_REQUEST['page_num'] : 1;
//get ids
$q = "select id from trees where title like ? or description like ? ";
$st = $this->dbconn->Prepare($q);
$r1 = $this->dbconn->getAll($st, array($filter_keyword, $filter_keyword));
$q = "select tree_id from tree_parameters where value like ? or node like ? ";
$st = $this->dbconn->Prepare($q);
$r2 = $this->dbconn->getAll($st, array($filter_keyword, $filter_keyword));
$q = "select t.id from trees t LEFT JOIN users u ON u.id= t.user_id where u.name like ? or u.description like ? or u.email like ? ";
$st = $this->dbconn->Prepare($q);
$r3 = $this->dbconn->getAll($st, array($filter_keyword, $filter_keyword, $filter_keyword));
$r = array_merge($r1, $r2, $r3);
$r_ids = array();
foreach ($r as $row) {
$r_ids[] = $row[0];
}
rsort($r_ids);
$pages_count = round(count($r_ids) / 10 + 0.4);
$tree_model = new Tree($this->dbconn);
$trees = $tree_model->fetchAll(array('filter' => " WHERE id in (" . implode(",", $r_ids) . ") LIMIT " . ($page_num - 1) * 10 . ",10", 'values' => array()), 'all');
$this->smarty->Assign('keyword', $keyword);
$this->smarty->Assign('trees', $trees);
$this->smarty->Assign('page_num', $page_num);
$this->smarty->Assign('pages_count', $pages_count);
$this->display('Search/result.tpl');
}
示例2: index
function index($varnish_cashe = NULL)
{
//Последно регистрирани
$user_model = new User($this->dbconn);
$users = $user_model->fetchAll(array('filter' => ' ORDER BY id desc LIMIT 10 ', 'values' => array()));
$this->smarty->Assign('users', $users);
//Последно създадени дървета
$tree_model = new Tree($this->dbconn);
$trees = $tree_model->fetchAll(array('filter' => ' ORDER BY id desc LIMIT 10 ', 'values' => array()), 'all');
$this->smarty->Assign('trees', $trees);
$this->display('Main/main.tpl');
}
示例3: index
function index($id)
{
if ($id) {
$tree = new Tree($this->dbconn, $id);
$tree->fetch();
$tree->fetchParamsOptimized();
$this->smarty->Assign('tree', $tree);
$this->display('Tree/view.tpl');
} else {
$page_num = isset($_REQUEST['page_num']) ? $_REQUEST['page_num'] : 1;
$tree = new Tree($this->dbconn);
$trees = $tree->fetchAll(array('filter' => ' ORDER BY id DESC LIMIT ' . ($page_num - 1) * 10 . ', 10 ', 'values' => array()), 'all');
$trees_count = $tree->fetchCount(array());
$pages_count = round($trees_count / 10 + 0.4);
$this->smarty->Assign('trees', $trees);
$this->smarty->Assign('pages_count', $pages_count);
$this->smarty->Assign('page_num', $page_num);
$this->display('Tree/list.tpl');
}
}
示例4: getTrees
public function getTrees()
{
$tree_model = new Tree($this->dbconn);
$this->trees = $tree_model->fetchAll(array('filter' => ' WHERE user_id=? order by id desc ', 'values' => array($this->id)));
}