I am using GoDaddy shared hosting plan and looks like there are some issues on using the mysqli
and mysqlnd
in all versions of PHP 7,7.1,7.2, and 7.3 on their hosting.
After many tries on changing and updating PHP versions and modules I, eventually, gave up using the get_result()
function as I am getting this error
Uncaught Error: Call to undefined method mysqli_stmt::get_result()
What other function can I use instead of theget_result()
to make sure there are rows in the $result
?
if ($stmt = $conn->prepare($query)) {
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$items[] = $row;
}
$stmt->free_result();
$stmt->close();
}
$conn->close();
}