Hi. This is my first post to the forum 🙂
I've got a PHP script that stores a MySQL result in $this->activeResult. The code is as below:
## Variable to store the array
$output = array();
$i = 1;
$this->ErrorOut('MySQL',mysql_num_rows($this->activeResult).' rows in result');
while ($r = mysql_fetch_array($this->activeResult)) {
$this->ErrorOut('MySQL','called '.$i);
$output[] = $r;
$i++;
}
$this->ErrorOut('MySQL',mysql_num_rows($this->activeResult).' rows in result');
$this->ErrorOut('MySQL',count($output).' rows in array');
## Return the array
return $output;
There are 20 rows in the return result. The calls to mysql_num_rows() before and after the where block both give 20. The problem is that the code inside the while block is only executed 19 times and the array only has 19 elements inside it.
I've tried with other numbers and the mysql_fetch_array() always executes one less. I've tried with mysql_fetch_array(), mysql_fetch_row() and mysql_fetch_assoc()... all the same problem.
Any advice would be greatly appreciated. The actual output of the script can be seen here:
http://www.new.ormomedia.com/classes/