Answer the question
In order to leave comments, you need to log in
Why does an error appear when performing multiple queries to the database?
There is a database with a large amount of data, and I want to sort through all of them using the function:
function get_data_db($count, $offset) {
$servername = "localhost";
$db = "fann";
$u = "root";
$p = "****";
$mysqli = new mysqli($servername, $u, $p, $db);
$_arr = [];
$sql = "SELECT * FROM tbl ORDER BY r LIMIT $count OFFSET $offset";
if ($res = $mysqli->query($sql)) {
$res->data_seek(0);
while ($row = $res->fetch_assoc()) {
$arr['...'] = $row['...'];
$_arr[] = $arr;
}
}
$mysqli->close();
return $_arr;
}
$mysqli->close();
and at the end of each cycle the connection is reset, from which the base should not be overloaded. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question