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


PHP PMF_Db::fetchAll方法代码示例

本文整理汇总了PHP中PMF_Db::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Db::fetchAll方法的具体用法?PHP PMF_Db::fetchAll怎么用?PHP PMF_Db::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMF_Db的用法示例。


在下文中一共展示了PMF_Db::fetchAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 /**
  * The main search function for the full text search
  *
  * @param   string  $searchterm     Text/Number (solution id)
  * @param   boolean $allLanguages   true to search over all languages
  * @param   boolean $hasMore        true to disable the results paging
  * @param   boolean $instantRespnse true to use it for Instant Response
  * @return  array
  */
 public function search($searchterm, $allLanguages = true, $hasMore = false, $instantResponse = false)
 {
     $fdTable = SQLPREFIX . 'faqdata';
     $fcrTable = SQLPREFIX . 'faqcategoryrelations';
     $condition = array($fdTable . '.active' => "'yes'");
     // Search in all or one category?
     if (!is_null($this->categoryId)) {
         $selectedCategory = array($fcrTable . '.category_id' => $searchcategory);
         $condition = array_merge($selectedCategory, $condition);
     }
     if (!$allLanguages && !is_numeric($searchterm)) {
         $selectedLanguage = array($fdTable . '.lang' => "'" . $this->language . "'");
         $condition = array_merge($selectedLanguage, $condition);
     }
     if (is_numeric($searchterm)) {
         // search for the solution_id
         $result = $this->db->search($fdTable, array($fdTable . '.id AS id', $fdTable . '.lang AS lang', $fdTable . '.solution_id AS solution_id', $fcrTable . '.category_id AS category_id', $fdTable . '.thema AS question', $fdTable . '.content AS answer'), $fcrTable, array($fdTable . '.id = ' . $fcrTable . '.record_id', $fdTable . '.lang = ' . $fcrTable . '.record_lang'), array($fdTable . '.solution_id'), $searchterm, $condition);
     } else {
         $result = $this->db->search($fdTable, array($fdTable . '.id AS id', $fdTable . '.lang AS lang', $fcrTable . '.category_id AS category_id', $fdTable . '.thema AS question', $fdTable . '.content AS answer'), $fcrTable, array($fdTable . '.id = ' . $fcrTable . '.record_id', $fdTable . '.lang = ' . $fcrTable . '.record_lang'), array($fdTable . '.thema', $fdTable . '.content', $fdTable . '.keywords'), $searchterm, $condition);
     }
     if ($result) {
         $num = $this->db->numRows($result);
     }
     if ($num == 0) {
         return array();
     } else {
         return $this->db->fetchAll($result);
     }
 }
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:38,代码来源:Search.php

示例2: search

 /**
  * The main search function for the full text search
  *
  * @param string  $searchterm   Text/Number (solution id)
  * @param boolean $allLanguages true to search over all languages
  * 
  * @return  array
  */
 public function search($searchterm, $allLanguages = true)
 {
     $fdTable = SQLPREFIX . 'faqdata';
     $fcrTable = SQLPREFIX . 'faqcategoryrelations';
     $condition = array($fdTable . '.active' => "'yes'");
     $search = PMF_Search_Factory::create($this->language, array('database' => PMF_Db::getType()));
     // Search in all or one category?
     if (!is_null($this->categoryId) && 0 < $this->categoryId) {
         $selectedCategory = array($fcrTable . '.category_id' => $this->categoryId);
         $condition = array_merge($selectedCategory, $condition);
     }
     if (!$allLanguages && !is_numeric($searchterm)) {
         $selectedLanguage = array($fdTable . '.lang' => "'" . $this->language->getLanguage() . "'");
         $condition = array_merge($selectedLanguage, $condition);
     }
     $search->setDatabaseHandle($this->db)->setTable($fdTable)->setResultColumns(array($fdTable . '.id AS id', $fdTable . '.lang AS lang', $fdTable . '.solution_id AS solution_id', $fcrTable . '.category_id AS category_id', $fdTable . '.thema AS question', $fdTable . '.content AS answer'))->setJoinedTable($fcrTable)->setJoinedColumns(array($fdTable . '.id = ' . $fcrTable . '.record_id', $fdTable . '.lang = ' . $fcrTable . '.record_lang'))->setConditions($condition);
     if (is_numeric($searchterm)) {
         $search->setMatchingColumns(array($fdTable . '.solution_id'));
     } else {
         $search->setMatchingColumns(array($fdTable . '.thema', $fdTable . '.content', $fdTable . '.keywords'));
     }
     $result = $search->search($searchterm);
     if (!$this->db->num_rows($result)) {
         return array();
     } else {
         return $this->db->fetchAll($result);
     }
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:36,代码来源:Search.php

示例3: getAll

 /**
  * Fetches all configuration items into an array
  *
  * @return void
  */
 public function getAll()
 {
     $query = sprintf("\n            SELECT\n                config_name, config_value\n            FROM\n                %sfaqconfig", SQLPREFIX);
     $result = $this->db->query($query);
     $config = $this->db->fetchAll($result);
     foreach ($config as $items) {
         $this->config[$items->config_name] = $items->config_value;
     }
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:14,代码来源:Configuration.php

示例4: getByLang

 /**
  * Retrieve all the stop words by a certain language
  * 
  * @param string $lang Language to retrieve stop words by
  * @param boolean wordsOnly
  * 
  * @return array
  */
 public function getByLang($lang = null, $wordsOnly = false)
 {
     $lang = is_null($lang) ? $this->language : $lang;
     $sql = sprintf("SELECT id, lang, LOWER(stopword) AS stopword FROM {$this->table_name} WHERE lang = '%s'", $lang);
     $result = $this->db->query($sql);
     $retval = array();
     if ($wordsOnly) {
         while (($row = $this->db->fetch_object($result)) == true) {
             $retval[] = $row->stopword;
         }
     } else {
         return $this->db->fetchAll($result);
     }
     return $retval;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:23,代码来源:Stopwords.php

示例5: fetchAll

 /**
  * Fetches all entries, if parameter = null, otherwise all from the given
  * array like array(1, 2, 3)
  *
  * @param array $ids Array of IDs
  * 
  * @return array
  * @throws PMF_Exception
  */
 public function fetchAll(array $ids = null)
 {
     $ratings = array();
     $query = sprintf("\n            SELECT\n                id,\n                artikel as record_id,\n                vote as sumVotings,\n                usr as numVotings,\n                datum as date,\n                ip\n            FROM\n                %sfaqvoting\n            WHERE\n                1=1", SQLPREFIX);
     if (!is_null($ids)) {
         $query .= sprintf("\n            AND \n                id IN (%s)", implode(', ', $ids));
     }
     $result = $this->db->query($query);
     if (!$result) {
         throw new PMF_Exception($this->db->error());
     } else {
         $ratings = $this->db->fetchAll($result);
     }
     return $ratings;
 }
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:24,代码来源:Rating.php

示例6: getAll

 /**
  * Fetches all configuration items into an array
  *
  * @return void
  * @access public
  * @author Thorsten Rinne <thorsten@phpmyfaq.de>
  */
 public function getAll()
 {
     global $PMF_LANG, $LANG_CONF;
     // Load the Configuration Keys
     if (!isset($LANG_CONF)) {
         // Hack: avoid circular reference
         $PMF_CONF['main.maxAttachmentSize'] = 2048000;
         require_once dirname(dirname(__FILE__)) . '/lang/language_en.php';
     }
     $query = sprintf("\n            SELECT\n                config_name, config_value\n            FROM\n                %sfaqconfig", SQLPREFIX);
     $result = $this->db->query($query);
     $config = $this->db->fetchAll($result);
     foreach ($config as $items) {
         $this->config[$items->config_name] = $items->config_value;
     }
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:23,代码来源:Configuration.php


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