当前位置: 首页>>代码示例>>PHP>>正文


PHP Tree::fetchAll方法代码示例

本文整理汇总了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');
 }
开发者ID:arimano,项目名称:plyloedit,代码行数:30,代码来源:SearchController.php

示例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');
 }
开发者ID:arimano,项目名称:plyloedit,代码行数:12,代码来源:MainController.php

示例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');
     }
 }
开发者ID:arimano,项目名称:plyloedit,代码行数:20,代码来源:TreeController.php

示例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)));
 }
开发者ID:arimano,项目名称:plyloedit,代码行数:5,代码来源:user.class.php


注:本文中的Tree::fetchAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。