MySQL Unbuffered Query Behavior Change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was previously on PHP 5.1.6 and was using the following code:

$dbr = mysql_unbuffered_query($query, $this->con);

while($row = mysql_fetch_array($dbr, $assoc ? MYSQL_ASSOC : MYSQL_NUM))
    $this->result[] = $row;

$this->rows = mysql_num_rows($dbr);

It worked properly. The documentation at
http://www.php.net/manual/en/function.mysql-num-rows.php indicates
that mysql_num_rows won't return the correct result on unbuffered
queries until all of the rows had been fetched, but since I was
looping through and fetching all rows with mysql_fetch_array, it
worked properly and wasn't a problem.

I've upgraded to PHP 5.3.5 and now mysql_num_rows always returns 0. I
am fetching all rows before calling mysql_num_rows, just like the
documentation says to do, so mysql_num_rows should return the correct
result. Why is it not? Is the documentation wrong now (should it have
been updated to say that mysql_num_rows now NEVER works with
unbuffered queries instead of saying you have to fetch all rows
first)? Is there a bug in PHP? Or am I doing something wrong and it
just coincidentally worked before?

Thanks,

Nick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux