简体   繁体   English

使用PHP显示MySQL临时表的结果-缓存?

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

I am currently having an issue where MySQL is only displaying 1 of my 3 rows in a dynamic Temporary Table I've created in a PHP page. 我目前遇到一个问题,其中MySQL仅在我在PHP页面中创建的动态临时表中显示3行中的1行。 I can confirm how many rows the TmpTable has via: 我可以通过以下方式确认TmpTable的行数:

$numrows = mysqli_num_rows($doResults);

(returns 3) (返回3)

But when I do my while ($rows=mysqli_fetch_array($doResults)) { } , only 1 of the 3 rows are returned/displayed. 但是,当我执行while ($rows=mysqli_fetch_array($doResults)) { } ,仅返回/显示3行中的1行。 The one row is returned correctly with all fields requested. 正确返回了第一行,并请求了所有字段。

Has anyone had any issues with some sort of Caching, etc ... ? 有人在某种缓存方面有问题吗?

mysqli_fetch_array() returns the next record in the result set, only one record. mysqli_fetch_array()返回结果集中的下一条记录,仅一条记录。 The name of your variable $row s suggests that you expect otherwise. 变量$ row 的名称表明您另有期望。

Try something like 尝试类似

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