简体   繁体   中英

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. I can confirm how many rows the TmpTable has via:

$numrows = mysqli_num_rows($doResults);

(returns 3)

But when I do my while ($rows=mysqli_fetch_array($doResults)) { } , only 1 of the 3 rows are returned/displayed. 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. The name of your variable $row suggests that you expect otherwise. 表明您另有期望。

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";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM