I find a snippet code:
<?php
$sql = "SELECT * FROM users WHERE first='sof';";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
var_dump($result);
if($resultCheck > 0){
while($row = mysqli_fetch_assoc($result)){
var_dump($row) ;
}
}
I have a question about the upper code:
does the $result = mysqli_query($conn, $sql);
query out all the user data?
or in the $row = mysqli_fetch_assoc($result)
then query out one by one yet?
http://php.net/manual/en/mysqlinfo.concepts.buffering.php
Queries are using the buffered mode by default. This means that query results are immediately transferred from the MySQL Server to PHP and then are kept in the memory of the PHP process. This allows additional operations like counting the number of rows, and moving (seeking) the current result pointer. It also allows issuing further queries on the same connection while working on the result set. The downside of the buffered mode is that larger result sets might require quite a lot memory. The memory will be kept occupied till all references to the result set are unset or the result set was explicitly freed, which will automatically happen during request end the latest. The terminology "store result" is also used for buffered mode, as the whole result set is stored at once.