unbuffered resultsets: "mysqli_num_rows() will not return the correct number of rows.." ? [message #171063] |
Mon, 20 December 2010 15:37 |
David
Messages: 2 Registered: December 2010
Karma:
|
Junior Member |
|
|
Apologies if this is a stupid question, but what does the following somewhat
stern warning in the mysqli_result->num_rows manual page actually mean in
practice?
"The use of mysqli_num_rows() depends on whether you use buffered or
unbuffered result sets. In case you use unbuffered resultsets
mysqli_num_rows() will not return the correct number of rows until all the
rows in the result have been retrieved."
-- http://www.php.net/manual/en/mysqli-result.num-rows.php
I don't knowingly use buffered resultsets (PHP output comes out unbuffered
unless explicitly specified otherwise, doesn't it?), so I'm a little
concerned that the above warning might affect me?
At which point have "all [of] the rows in the result [..] been retrieved"?
Is it when you you make your query, eg:
$result = mysqli_query($db, $query);
or does that only create storage _for_ the result but not actually populate
it at that point, requiring later code such as the following to populate the
resultset(?), eg:
while ($row = mysqli_fetch_array($result)) {
// Stuff things into variables..
}
Thanks for any clarification anyone can offer,
David.
|
|
|