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


PHP mysqli_result::fetch_fields方法代码示例

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


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

示例1: __construct

 /**
  * @param Connection $connection
  * @param null|\mysqli_result $result
  */
 public function __construct(Connection $connection, $result = null)
 {
     $this->connection = $connection;
     if ($result instanceof \mysqli_result) {
         $this->result = $result;
         $this->num_rows = $this->result->num_rows;
         $this->fields = $this->result->fetch_fields();
     } else {
         $this->affected_rows = $this->getMysqliConnection()->affected_rows;
     }
 }
开发者ID:Dewstar,项目名称:SphinxQL-Query-Builder,代码行数:15,代码来源:ResultSet.php

示例2: getFields

 /**
  * Returns an array of fields according to columns in the result.
  *
  * @return \Bitrix\Main\Entity\ScalarField[]
  */
 public function getFields()
 {
     if ($this->resultFields == null) {
         $this->resultFields = array();
         if (is_object($this->resource)) {
             $fields = $this->resource->fetch_fields();
             if ($fields && $this->connection) {
                 $helper = $this->connection->getSqlHelper();
                 foreach ($fields as $field) {
                     $this->resultFields[$field->name] = $helper->getFieldByColumnType($field->name, $field->type);
                 }
             }
         }
     }
     return $this->resultFields;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:mysqliresult.php

示例3: fetch

 /**
  * @param mysqli_result $mysqli_result
  * @param bool $single
  * @return array|bool|null
  */
 public function fetch($mysqli_result, $single)
 {
     $this->_('fields', array());
     foreach ($mysqli_result->fetch_fields() as $field) {
         $this->_('fields')[$field->name] = $this->rules[$this->types[$field->type]];
     }
     switch (true) {
         case !$mysqli_result:
             return null;
         case $single && $mysqli_result->num_rows == 0:
             $result = false;
             break;
         case $single:
             $result = $this->cast($mysqli_result->fetch_assoc());
             break;
         case $mysqli_result->num_rows == 0:
             $result = array();
             break;
         default:
             $result = array();
             while ($row = $mysqli_result->fetch_assoc()) {
                 $result[] = $this->cast($row);
             }
     }
     $mysqli_result->free();
     return $result;
 }
开发者ID:enderteszla,项目名称:phpframework-etc,代码行数:32,代码来源:Result.php

示例4: fetchFieldProperties

 /**
  * Return properties taken from result fields as array(props, default props)
  * 
  * @return array
  */
 protected function fetchFieldProperties()
 {
     foreach ($this->native->fetch_fields() as $i => $field) {
         $props[] = $this->convertFieldProperties($field, $i);
     }
     return $props;
 }
开发者ID:jasny,项目名称:Q,代码行数:12,代码来源:Result.php

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

示例6: displayRecords

 /**
  * Purpose: Display the results of a database query in an HTML table
  * @param mysqli_result $qryResults Results of a previous database query
  */
 public static function displayRecords($qryResults)
 {
     // Display the opening table tag
     echo "<table>\n";
     // Display a table row opening tag
     echo "    <tr>";
     // LOOP for all query result columns
     foreach ($qryResults->fetch_fields() as $fieldInfo) {
         // Display the column name within a table header tag
         echo "<th>{$fieldInfo->name}</th>";
     }
     // Display a table row closing tag
     echo "</tr>\n";
     // LOOP for all the query rows returned
     while ($row = $qryResults->fetch_row()) {
         // Display a table row opening tag
         echo "    <tr>";
         // LOOP for all the query result columns
         for ($i = 0; $i < $qryResults->field_count; $i++) {
             // Display the value of this query result row and column
             echo "<td>" . htmlspecialchars($row[$i]) . "</td>";
             //                $row[$i] = htmlspecialchars( $row[$i] );
             //                echo "<td>{$row[$i]}</td>";
         }
         // Display a table row closing tag
         echo "    </tr>\n";
     }
     // Display the closing table tag
     echo "</table>\n";
 }
开发者ID:BethelH,项目名称:CWEB280-FinalProject,代码行数:34,代码来源:DbObject.class.php


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