• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mysqli_result类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: result

 public function result($a_type = null)
 {
     if (!$this->m_result or !$this->m_result instanceof mysqli_result) {
         return $this->m_result;
     }
     $r = array();
     do {
         $row = false;
         switch ($a_type) {
             default:
             case ZDatabase::RESULT_TYPE_NUM:
                 $row = $this->m_result->fetch_array(MYSQLI_NUM);
                 break;
             case ZDatabase::RESULT_TYPE_ASSOC:
                 $row = $this->m_result->fetch_array(MYSQLI_ASSOC);
                 break;
             case ZDatabase::RESULT_TYPE_BOTH:
                 $row = $this->m_result->fetch_array(MYSQLI_BOTH);
                 break;
             case ZDatabase::RESULT_TYPE_OBJECT:
                 $row = $this->m_result->fetch_object();
                 break;
             case ZDatabase::RESULT_TYPE_RAW:
                 return $this->m_result;
         }
         if (!$row) {
             break;
         }
         $r[] = $row;
     } while (1);
     return $r;
 }
开发者ID:BGCX261,项目名称:zoombi-svn-to-git,代码行数:32,代码来源:mysqlidatabaseadapter.php


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


示例3: fetch

 /**
  * @param Entity $entity
  * @return EntityManagerMysqli
  */
 protected function fetch(\mysqli_result $result, Entity $entity = null)
 {
     while ($data = $result->fetch_assoc()) {
         $this->add($entity->getClone()->serialize($data));
     }
     return $this;
 }
开发者ID:monokit,项目名称:monokit,代码行数:11,代码来源:EntityManagerMysqli.php


示例4: close

 /**
  * 
  * 关闭 stmt result mysqli的函数,传入这三个东西就行
  * @param mysqli,stmt,result
  */
 static function close(mysqli $mysqli = null, mysqli_stmt $stmt = null, mysqli_result $result = null)
 {
     if ($result != null) {
         $result->free();
     }
     if ($stmt != null) {
         $stmt->close();
     }
     if ($mysqli != null) {
         $mysqli->close();
     }
 }
开发者ID:reducm,项目名称:JASEnglish,代码行数:17,代码来源:db.class.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: loadDefaultData

function loadDefaultData($totalCount, mysqli_result $result)
{
    if ($totalCount == 0) {
        echo "暂无资讯";
        return;
    } else {
        if ($totalCount > 0) {
            $cnt = 0;
            while ($row = $result->fetch_assoc()) {
                if ($cnt < DEFAULT_SHOW) {
                    $list_id = $row["info_id"];
                    echo "<div class=\"list\">";
                    echo "<a href=\"" . $row["origin_link"] . "\" class=\"nav_list\" data-id={$list_id} onclick=\"count({$list_id})\">";
                    echo "<p class=\"caption\">";
                    echo $row["caption"];
                    echo "</p>";
                    echo "<p class=\"subhead\">";
                    echo $row["subhead"];
                    echo "</p>";
                    echo "<div class=\"footer\">";
                    echo "<span class=\"text_des\">";
                    echo $row["origin"];
                    echo "</span>";
                    echo "&nbsp";
                    echo "&nbsp";
                    echo "<span class=\"num_des\">";
                    echo substr($row["publish_date"], 5, 5);
                    echo "</span>";
                    echo "&nbsp";
                    echo "&nbsp";
                    echo "<div class=\"like\">";
                    echo "<img src=\"../images/grayheart.png\" class=\"icon\">";
                    echo "<span class=\"info_like\">";
                    echo showFavNum($row["fav"]);
                    echo "</span>";
                    echo "</div>";
                    echo "</div>";
                    echo "<img src=\"" . $row["pic_link"] . "\" class=\"show_pic\">";
                    echo "</a>";
                    echo "</div>";
                    echo "<hr/>";
                    $cnt++;
                } else {
                    break;
                    return;
                }
            }
        }
    }
}
开发者ID:pinkpoppy,项目名称:fx,代码行数:50,代码来源:infomation.php


示例7: loadDefaultData

function loadDefaultData($totalCount, mysqli_result $result)
{
    if ($totalCount == 0) {
        return;
    } else {
        if ($totalCount > 0) {
            $cnt = 0;
            while ($row = $result->fetch_assoc()) {
                if ($cnt < DEFAULT_SHOW) {
                    $list_id = $row["info_id"];
                    echo "<div class=\"list\">";
                    echo "<a href=\"" . $row["origin_link"] . "\" class=\"e_wine_list\" data-id={$list_id} onclick=\"count({$list_id})\">";
                    echo "<p class=\"wine_caption\">";
                    echo $row["caption"];
                    echo "</p>";
                    echo "<p class='wine_subhead'>";
                    echo $row['subhead'];
                    echo "</p>";
                    echo "<div class=\"wine_footer\">";
                    echo "<span class=\"wine_orgin\">";
                    echo $row["origin"];
                    echo "</span>";
                    echo "&nbsp";
                    echo "&nbsp";
                    echo "<span class=\"wine_price\">";
                    echo $row["publish_date"];
                    echo "</span>";
                    echo "&nbsp";
                    echo "&nbsp";
                    echo "<div class=\"wine_fav\">";
                    echo "<img src=\"../images/grayheart.png\" class=\"icon\">";
                    echo "<span class=\"wine_fav_num\">";
                    echo showFavNum($row["fav"]);
                    echo "</span>";
                    echo "</div>";
                    echo "</div>";
                    echo "<img src=\"" . $row["pic_link"] . "\" class=\"wine_show_pic\">";
                    echo "</a>";
                    echo "</div>";
                    echo "<hr/>";
                    $cnt++;
                } else {
                    break;
                    return;
                }
            }
        }
    }
}
开发者ID:pinkpoppy,项目名称:fx,代码行数:49,代码来源:ebusiness.php


示例8: queryRows

 public function queryRows($sql)
 {
     $aaData = array();
     if (!$sql) {
         return false;
     }
     if (!$this->real_query($sql)) {
         throw new exception($this->error, $this->errno);
     }
     $result = new mysqli_result($this);
     while ($row = $result->fetch_object()) {
         $aaData[] = $row;
     }
     return $aaData;
 }
开发者ID:HomelessCoder,项目名称:weedo,代码行数:15,代码来源:db_mysqli.php


示例9: display_results

function display_results(mysqli_result $res)
{
    // Table header:
    echo '<table class="tbl">
	<tr>
		<th>Host</th>
		<th>User</th>
	</tr>
';
    // Fetch and print all the records:
    while ($row = $res->fetch_object()) {
        echo '<tr>
			<td>' . $row->host . '</td>
			<td>' . $row->user . '</td>
		</tr>';
    }
    echo '</table>';
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:18,代码来源:mysqli.php


示例10: rewind

 /**
  * Rewind
  * 
  */
 public function rewind()
 {
     $this->currentComplete = false;
     $this->position = 0;
     if ($this->resource instanceof \mysqli_stmt) {
         //$this->resource->reset();
     } else {
         $this->resource->data_seek(0);
         // works for both mysqli_result & mysqli_stmt
     }
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:15,代码来源:Result.php


示例11: rewind

 /**
  * Rewind
  */
 public function rewind()
 {
     if ($this->position !== 0) {
         if ($this->isBuffered === false) {
             throw new Exception\RuntimeException('Unbuffered results cannot be rewound for multiple iterations');
         }
     }
     $this->resource->data_seek(0); // works for both mysqli_result & mysqli_stmt
     $this->currentComplete = false;
     $this->position = 0;
 }
开发者ID:necrogami,项目名称:zf2,代码行数:14,代码来源:Result.php


示例12: loadMore

function loadMore($page, mysqli_result $result)
{
    $pos = 0;
    $cnt = 0;
    $arry = array();
    while ($row = $result->fetch_assoc()) {
        if ($pos != $page * DEFAULT_SHOW) {
            $pos++;
            continue;
        } else {
            if ($cnt < DEFAULT_SHOW) {
                array_push($arry, $row);
                $cnt++;
            } else {
                break;
                return;
            }
        }
    }
    return json_encode($arry, JSON_UNESCAPED_UNICODE);
}
开发者ID:pinkpoppy,项目名称:fx,代码行数:21,代码来源:loadMoreInfomation.php


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


示例14: getFetchArrays

 /**
  * Get all array data
  *
  * @return array
  */
 public function getFetchArrays()
 {
     $data = array();
     if ($this->resource instanceof \mysqli_result) {
         $result = $this->resource;
     } else {
         if ($this->resource instanceof \mysqli_stmt) {
             $result = $this->resource->get_result();
         } else {
             if ($this->resource instanceof \mysqli) {
                 $result = $this->resource->store_result();
             }
         }
     }
     while ($row = $result->fetch_array(\MYSQLI_ASSOC)) {
         $data[] = $row;
     }
     return $data;
 }
开发者ID:musicsnap,项目名称:Yaf.Global.Library,代码行数:24,代码来源:Result.php


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


示例16: fetch_row

 /**
  * 从结果集中取得一行作为数字索引数组
  */
 function fetch_row(mysqli_result $query)
 {
     return $query->fetch_row();
 }
开发者ID:flyysr,项目名称:emlog,代码行数:7,代码来源:mysqlii.php


示例17: fetch

 /**
  * Извлечение данных
  *
  * @return array|null
  */
 protected function fetch()
 {
     if (!$this->isValidResult()) {
         return null;
     }
     return $this->query_result->fetch_array($this->fetch_type);
 }
开发者ID:white-bear,项目名称:php-db-layer,代码行数:12,代码来源:MysqliResult.php


示例18: Close

 /**
  * (non-PHPdoc)
  * @see Phine/Framework/Database/Interfaces/IDatabaseReader#Close()
  */
 function Close()
 {
     if (!$this->IsClosed()) {
         $this->result->close();
         $this->closed = true;
     }
 }
开发者ID:agentmedia,项目名称:phine-framework,代码行数:11,代码来源:Reader.php


示例19: freeResult

 /**
  * Очищение результатов
  */
 protected function freeResult()
 {
     if ($this->query_result !== null) {
         $this->query_result->free_result();
         $this->query_result = null;
     }
     $this->result = null;
 }
开发者ID:white-bear,项目名称:php-db-layer,代码行数:11,代码来源:MysqliStatement.php


示例20: nextRecord

 public function nextRecord()
 {
     if (is_object($this->handle) && ($data = $this->handle->fetch_assoc())) {
         return $data;
     } else {
         return false;
     }
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:8,代码来源:MySQLQuery.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mysqli_stmt类代码示例发布时间:2022-05-23
下一篇:
PHP mysqli类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap