How can I use
$stmt = $db->query($sqlString, MYSQLI_USE_RESULT);
But with prepare function? I need it, because I am using bind params, but now I need to also use MYSQLI_USE_RESULT for big data.
I need something like this:
$stmt = $db->prepare($sqlString, MYSQLI_USE_RESULT);
My Answer:
prepare("SELECT * FROM table WHERE id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
// process the row data
}
$stmt->close();
Rate this post
4 of 5 based on 7027 votesComments