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


PHP mysqli_result::fetch_all方法代码示例

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


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

示例1: fetchAll

 /**
  * @param integer $fetchType
  * @throws Recipe_Exception_Sql
  * @return array|mixed
  */
 public function fetchAll($fetchType = null)
 {
     if ($fetchType === null) {
         $fetchType = self::DEFAULT_FETCH_TYPE;
     }
     return $this->result->fetch_all($fetchType);
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:12,代码来源:MySQLi.php

示例2: fetchAllNum

 /**
  * Fetches all the rows as an array of indexed arrays
  *
  * @return array|mixed|null
  */
 public function fetchAllNum()
 {
     if ($this->stored !== null) {
         return $this->stored;
     }
     return $this->result->fetch_all(MYSQLI_NUM);
 }
开发者ID:Dewstar,项目名称:SphinxQL-Query-Builder,代码行数:12,代码来源:ResultSet.php

示例3: fetchAll

 /**
  * 获取所有结果
  *
  * @return array|mixed|null
  */
 public function fetchAll()
 {
     $this->getResult();
     if ($this->result) {
         $this->mysql->num_rows = $this->result->num_rows;
         if (method_exists($this->result, 'fetch_all')) {
             $data = $this->result->fetch_all(MYSQLI_ASSOC);
         } else {
             $data = array();
             while ($row = $this->result->fetch_assoc()) {
                 $data[] = $row;
             }
         }
         return $data;
     } else {
         return null;
     }
 }
开发者ID:qazzhoubin,项目名称:emptyphp,代码行数:23,代码来源:Result.php

示例4: fetchResource

 /**
  * @param \mysqli_result $resource
  * @param string         $column
  *
  * @return mixed[]
  */
 protected function fetchResource($resource, $column)
 {
     $fields = $resource->fetch_fields();
     if (count($fields) == 0) {
         return [];
     }
     $result = $resource->fetch_all(MYSQLI_ASSOC);
     if (!is_array($result)) {
         return [];
     }
     $resource->free();
     $this->fixTypes($result, $fields, $column);
     return $result;
 }
开发者ID:binsoul,项目名称:db-platform-mysql,代码行数:20,代码来源:QueryResult.php

示例5: fetch

 public function fetch()
 {
     if (!$this->_cursor) {
         return null;
     }
     $res = array();
     if (method_exists('mysqli_result', 'fetch_all')) {
         $res = $this->_cursor->fetch_all(MYSQL_ASSOC);
     } else {
         while ($tmp = $this->_cursor->fetch_array(MYSQL_ASSOC)) {
             $res[] = $tmp;
         }
     }
     return $res;
 }
开发者ID:ravikathaitarm01,项目名称:fluenz1,代码行数:15,代码来源:MySqli.php

示例6: _fetch_all

 /**
  * 将sql查询结果全部转化成数组
  *
  * @param \mysqli_result $res 要转化的查询
  * @return array 查询的结果
  */
 protected function _fetch_all($res)
 {
     if (method_exists('mysqli_result', 'fetch_all')) {
         $data = $res->fetch_all(MYSQLI_ASSOC);
     } else {
         for ($data = []; $tmp = $res->fetch_array(MYSQLI_ASSOC);) {
             $data[] = $tmp;
         }
     }
     return $data;
 }
开发者ID:snje1987,项目名称:minifw,代码行数:17,代码来源:Mysqli.php

示例7: fetchAll

 /**
  * Fetches all result rows and returns the result set as an associative array, a numeric array, or both.
  * @param int $resultType MYSQLI_ASSOC, MYSQLI_NUM or MYSQLI_BOTH
  * @return mixed
  */
 public function fetchAll($resultType = MYSQLI_ASSOC)
 {
     return $this->query->fetch_all($resultType);
 }
开发者ID:Sala,项目名称:skype-stats,代码行数:9,代码来源:DB.php

示例8: getAll

 /**
  * Returns the values of all rows.
  * CAUTION: resets the result pointer.
  * 
  * {@internal Mind the performance: not ifs in while loop}}
  * 
  * @param  int      $resulttype  A DB_Result::FETCH::% constant
  * @param  boolean  $map         Add mapping for roles   
  * @return array
  */
 function getAll($resulttype = DB::FETCH_ORDERED)
 {
     if ($resulttype == DB::FETCH_VALUE) {
         return $this->getColumn();
     }
     $key_field = $this->getFieldIndex('result:key');
     $rows = array();
     $this->native->data_seek(0);
     $opt = $resulttype & ~0xff;
     if (isset($key_field)) {
         switch ($resulttype & 0xff) {
             case DB::FETCH_ORDERED:
                 while ($row = $this->native->fetch_row()) {
                     $rows[$row[$key_field]] = $row;
                 }
                 break;
             case DB::FETCH_ASSOC:
                 while ($row = $this->native->fetch_assoc()) {
                     $rows[$row['result:key']] = $row;
                 }
                 break;
             case DB::FETCH_FULLARRAY:
                 while ($row = $this->native->fetch_array()) {
                     $rows[$row[$key_field]] = $row;
                 }
                 break;
             case DB::FETCH_OBJECT:
                 while ($row = $this->native->fetch_object()) {
                     $rows[$row->{'result:key'}] = $row;
                 }
                 break;
             default:
                 while ($row = $this->fetchRow($resulttype)) {
                     $rows[] = $row;
                 }
                 if (!empty($rows)) {
                     $rows = array_combine($this->getColumn($key_field), $rows);
                 }
                 break;
         }
     } else {
         switch ($resulttype & 0xff) {
             case DB::FETCH_ORDERED:
                 if (function_exists('mysqli_fetch_all')) {
                     $rows = $this->native->fetch_all(MYSQLI_NUM);
                 } else {
                     while ($row = $this->native->fetch_row()) {
                         $rows[] = $row;
                     }
                 }
                 break;
             case DB::FETCH_ASSOC:
                 if (function_exists('mysqli_fetch_all')) {
                     $rows = $this->native->fetch_all(MYSQLI_ASSOC);
                 } else {
                     while ($row = $this->native->fetch_assoc()) {
                         $rows[] = $row;
                     }
                 }
                 break;
             case DB::FETCH_OBJECT:
                 while ($row = $this->native->fetch_object()) {
                     $rows[] = $row;
                 }
                 break;
             case DB::FETCH_FULLARRAY:
                 if (function_exists('mysqli_fetch_all')) {
                     $rows = $this->native->fetch_all(MYSQLI_BOTH);
                 } else {
                     while ($row = $this->native->fetch_array()) {
                         $rows[] = $row;
                     }
                 }
                 break;
             case DB::FETCH_PERTABLE:
                 while ($row = $this->fetchPerTable($opt)) {
                     $rows[] = $row;
                 }
                 break;
             case DB::FETCH_VALUE:
                 while ($row = $this->fetchValue(0, $opt)) {
                     $rows[] = $row;
                 }
                 break;
             case DB::FETCH_RECORD:
                 while ($row = $this->fetchRecord($opt)) {
                     $rows[] = $row;
                 }
                 break;
             case DB::FETCH_ROLES:
//.........这里部分代码省略.........
开发者ID:jasny,项目名称:Q,代码行数:101,代码来源:Result.php

示例9: fetchAll

 public function fetchAll()
 {
     return $this->result->fetch_all();
 }
开发者ID:popovdenis,项目名称:lessons-1,代码行数:4,代码来源:Database.php


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