I get some data from mysql via select.
$result = mysqli_query($cxn, $query);
Then I look through it with
if ($result!= false) { while ($row = mysqli_fetch_assoc($result)) { do_stuff(); } }
What I would like to do is add a line before while ONLY if the result is more than one line.
I understand that at first I could create an array from $row and then count them, but this may interfere with the convenience of while .
Question: is there a way to find out how many rows mysqli_fetch_assoc will generate without running it twice?
source share