Answer the question
In order to leave comments, you need to log in
Why is the script not outputting anything?
Hello! I want to explicitly clear the memory occupied by the query result. But for some reason, after such a procedure, nothing is displayed. What's the matter? After all, the memory was cleared after use, so there was plenty to take lines from. Here is the memory cleanup code:
<?php
$db = new mysqli("localhost", "root", "23210100", "Books");
$query = "SELECT * FROM Books WHERE Price>?";
$stmt = $db->prepare($query);
$var = 15.00;
$stmt->bind_param("d", $var);
$stmt->bind_result($isbn, $author, $title, $price);
$stmt->execute();
$result = $stmt->get_result();
while($stmt->fetch()){
echo "$isbn, $author, $title, $price<br>" ;
}
echo "Всего строк - " . $stmt->num_rows;
$result->free();
?>
Всего строк - 0
<?php
$db = new mysqli("localhost", "root", "23210100", "Books");
$query = "SELECT * FROM Books WHERE Price>?";
$stmt = $db->prepare($query);
$var = 15.00;
$stmt->bind_param("d", $var);
$stmt->bind_result($isbn, $author, $title, $price);
$stmt->execute();
//$result = $stmt->get_result();
while($stmt->fetch()){
echo "$isbn, $author, $title, $price<br>" ;
}
echo "Всего строк - " . $stmt->num_rows;
?>
0-672-31509-2, Pruitt, et al., Teach Yourself GIMP in 24 Hours, 33.26
0-672-31697-8, Michael Morgan, Java 2 for Professional Developers, 61.98
0-672-31745-1, Thomas Down, Installing Debian GNU/Linux, 33.26
Всего строк - 3
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