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


PHP mysqli_result::fetch_row方法代码示例

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


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

示例1: toNextRow

 /**
  * Moves the cursor to the next row
  *
  * @return static $this
  * @throws ResultSetException If the next row does not exist
  */
 public function toNextRow()
 {
     if (!$this->hasNextRow()) {
         throw new ResultSetException('The next row does not exist.');
     }
     if ($this->current_row === null) {
         $this->current_row = 0;
     } else {
         $this->current_row++;
     }
     $this->fetched = $this->result->fetch_row();
     return $this;
 }
开发者ID:Dewstar,项目名称:SphinxQL-Query-Builder,代码行数:19,代码来源:ResultSet.php

示例2: rowGenerator

 /**
  * @param \mysqli_result $result
  * @param $returnMode
  * @return \Generator
  */
 public function rowGenerator(\mysqli_result $result, $returnMode)
 {
     switch ($returnMode) {
         case self::RETURN_TYPE_ASSOC:
             (yield $result->fetch_assoc());
             break;
         case self::RETURN_TYPE_NUM:
             (yield $result->fetch_array(MYSQLI_NUM));
             break;
         case self::RETURN_TYPE_BOTH:
             (yield $result->fetch_array(MYSQLI_BOTH));
             break;
         case self::RETURN_TYPE_MYSQLI_ROW:
             (yield $result->fetch_row());
             break;
         case self::RETURN_TYPE_OBJ:
             (yield $result->fetch_object());
             break;
         default:
             (yield $result->fetch_assoc());
             break;
     }
 }
开发者ID:chilimatic,项目名称:database-component,代码行数:28,代码来源:MySQLiConnectionAdapter.php

示例3: fetchRow

 /**
  * @param \mysqli_result $result
  * @return array|null
  */
 public function fetchRow($result)
 {
     return $result->fetch_row();
 }
开发者ID:charger88,项目名称:orange.database,代码行数:8,代码来源:MySQL.php

示例4: fetch_row

 /**
  * @param mysqli_result $query_id
  * @return array|bool
  */
 public function fetch_row($query_id)
 {
     return $query_id ? $query_id->fetch_row() : false;
 }
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:8,代码来源:common_db.php

示例5: fetchLastRow

 public function fetchLastRow()
 {
     $this->result->data_seek($this->getNumRows() - 1);
     return $this->result->fetch_row();
 }
开发者ID:colibri-fw,项目名称:database,代码行数:5,代码来源:MySQL.php

示例6: createArray

 /**
  * Purpose: Creates an associative array to be used with the HtmlForm
  *   class' methods that populate lists.
  * @param mysqli_result $qryResults The query result record set.  The
  *   result should consist of two columns: the first column will contain
  *   an ID, and second will contain corresponding text.
  * @return array Associative array, where the array index comes from
  *   the qryResults' first column, and the array value comes from the
  *   qryResults' second column.
  */
 public static function createArray($qryResults)
 {
     // Create an empty result array
     $result = array();
     // Loop through all rows in the result set
     while ($row = $qryResults->fetch_row()) {
         // Set an entry in the result set with the index as the first
         // column in the result set, and the value as the second column
         $result[$row[0]] = $row[1];
     }
     // Return the result array
     return $result;
 }
开发者ID:BethelH,项目名称:CWEB280-FinalProject,代码行数:23,代码来源:DbObject.class.php

示例7: 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

示例8: fetch_row

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

示例9: getRowArrays

 /**
  * Get all fields of all records in one single non-associative array
  * It's basically all values available concatened in a single array
  * @param mysqli_result $result
  * @return array empty array if no result
  */
 public function getRowArrays(mysqli_result $result = null)
 {
     $arrayFromResultSet = array();
     if ($result != null) {
         while ($row = $result->fetch_row()) {
             foreach ($row as $value) {
                 $arrayFromResultSet[] = stripcslashes($value);
             }
         }
     }
     return $arrayFromResultSet;
 }
开发者ID:fiquett,项目名称:redmine-tools,代码行数:18,代码来源:DBMysql.php

示例10: enum

 /**
  * Returns the next available row as an enumerated array
  *  while ($row = $result->enum()) { echo $row[0]; }
  * @return array
  */
 public function enum()
 {
     return $this->result->fetch_row();
 }
开发者ID:priestd09,项目名称:sleekmvc,代码行数:9,代码来源:DatabaseResult.php

示例11: fetch_row

 /**
  * Fetch the current row as enumerated array
  *
  * @return array The row as array
  */
 protected function fetch_row()
 {
     return $this->resResult->fetch_row();
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:9,代码来源:Result.php

示例12: result

 /**
  * @param $res mysqli_result
  * @return mixed
  */
 public static function result(mysqli_result $res)
 {
     $row = $res->fetch_row();
     return $row[0];
 }
开发者ID:schoolphp,项目名称:library,代码行数:9,代码来源:functions.php

示例13: dbResult

 /**
  * Returns the contents of one cell from a MySQL result set
  *
  * @param    mysqli_result $recordSet The recordset to operate on
  * @param    int           $row       row to get data from
  * @param    mixed         $field     field to return
  * @return   mixed (depends on field content)
  */
 public function dbResult($recordSet, $row, $field = 0)
 {
     if ($this->_verbose) {
         $this->_errorlog("\n*** Inside database->dbResult ***");
         if (empty($recordSet)) {
             $this->_errorlog("\n*** Passed recordset isn't valid ***");
         } else {
             $this->_errorlog("\n*** Everything looks good ***");
         }
         $this->_errorlog("\n*** Leaving database->dbResult ***");
     }
     $retval = '';
     if ($recordSet->data_seek($row)) {
         if (is_numeric($field)) {
             $field = intval($field, 10);
             $row = $recordSet->fetch_row();
         } else {
             $row = $recordSet->fetch_assoc();
         }
         if ($row !== null && isset($row[$field])) {
             $retval = $row[$field];
         }
     }
     return $retval;
 }
开发者ID:mystralkk,项目名称:geeklog,代码行数:33,代码来源:mysqli.class.php

示例14: _fetchFieldList

 /**
  * Fetch an array of single field results
  *
  *
  * @param   mysqli_result  	$result The result object. A result set identifier returned by the select() function
  * @param   integer         $key    The index to use
  * @return  array           A sequential array of returned rows.
  */
 protected function _fetchFieldList($result, $key = 0)
 {
     $array = array();
     while ($row = $result->fetch_row()) {
         $array[] = $row[(int) $key];
     }
     $result->free();
     return $array;
 }
开发者ID:daodaoliang,项目名称:nooku-framework,代码行数:17,代码来源:mysqli.php

示例15:

<?php

require_once "connect.inc";
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
$mysql->real_query("SELECT 'foo' FROM test_062_table_1");
$myresult = new mysqli_result($mysql);
$row = $myresult->fetch_row();
$myresult->close();
$mysql->close();
var_dump($row);
print "done!";
开发者ID:alphaxxl,项目名称:hhvm,代码行数:11,代码来源:062.php


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