當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mysqli_result類代碼示例

本文整理匯總了PHP中mysqli_result的典型用法代碼示例。如果您正苦於以下問題:PHP mysqli_result類的具體用法?PHP mysqli_result怎麽用?PHP mysqli_result使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了mysqli_result類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

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

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

示例15: 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;未經允許,請勿轉載。