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

时间:2009-08-12 12:39:37

标签: php mysql caching

我目前遇到的问题是MySQL只在我在PHP页面中创建的动态临时表中显示我的3行中的1行。我可以确认TmpTable有多少行:

$numrows = mysqli_num_rows($doResults);

(返回3)

但是当我执行while ($rows=mysqli_fetch_array($doResults)) { }时,只返回/显示3行中的1行。正确返回一行并请求所有字段。

有没有人在使用某种缓存方面遇到任何问题......?

1 个答案:

答案 0 :(得分:0)

mysqli_fetch_array()返回结果集中的下一条记录,只返回一条记录。您的变量$ row s 的名称表明您不希望出现这种情况。

尝试类似

的内容
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";
}
相关问题