NogDog;11052421 wrote:mysqli_fetch_all()
However, be careful if there's a chance you could be pulling in a lot of records, as large PHP arrays are a good way to eat up memory.
That's one way, and a good one, with the understanding you may not want to grab anything huge.
Classic usage was something like:
<?php
//perhaps a listing of products. What page are we on? That determines the $start variable.
$start = $page_number-100+1;
$s = "select title,description,price from products limit $start, 100;";
$r = mysqli_query($s);
if ($r && $r->num_rows) {
$data_array = array();
$n = 0;
while ($row = mysqli_fetch_assoc($r)) {
$data_array[$n]['title'] = $row['title'];
$data_array[$n]['description'] = $row['description'];
$data_array[$n]['price'] = $row['price'];
$n++;
}
}