簡體   English   中英

使用PHP顯示MySQL臨時表的結果-緩存?

[英]Displaying results of a MySQL temp table using PHP - caching?

我目前遇到一個問題,其中MySQL僅在我在PHP頁面中創建的動態臨時表中顯示3行中的1行。 我可以通過以下方式確認TmpTable的行數:

$numrows = mysqli_num_rows($doResults);

(返回3)

但是,當我執行while ($rows=mysqli_fetch_array($doResults)) { } ,僅返回/顯示3行中的1行。 正確返回了第一行,並請求了所有字段。

有人在某種緩存方面有問題嗎?

mysqli_fetch_array()返回結果集中的下一條記錄,僅一條記錄。 變量$ row 的名稱表明您另有期望。

嘗試類似

error_reporting(E_ALL); // only for debugging
ini_set('display_errors', 1); // only for debugging

$numrows = mysqli_num_rows($doResults);
echo '<pre>debug: $numrows=', $numrows, "</pre>\n";
$dbgcRow = 0;
while($row=mysqli_fetch_array($doResults)) {
  // row counter / number of the current record
  echo '<pre>debug: $dbgcRow=', ++$dbgcRow, "</pre>\n";
  // print the values of the current record
  echo htmlentities(join(',', $row)), "<br />\n";
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM