PHP VERSION: 7.1 I have been following mmtuts PHP videos on how to build an uploading option for users. As I was following the video, the code that he wrote works perfectly fine on the localhost (database (mysql) through xampp) but then when I went to HostGator to connect it to an actual database. I get the error saying
Fatal error : Uncaught Error: Call to undefined function mysqli_stmt_get_result() in gallery.phpon line45
I looked up the error on this website, most of the answers said to check my PHP extensions but I am not being able to find the extensions mysqlnd and nd_mysqli in Hostgator control panel under PHP.INI. If you can guide me through that would be appreciated. However other answers also stated that I can use bind and fetch method and even after looking at how to do transform this code in to bind and fetch method, I am really not understanding it. I am completely new to PHP (7th day of trying to learn) so I am seeking advice on how to resolve this issue. Thank you in advance.
<?php
include_once 'includes/dbh.inc.php';
$sql = "SELECT * FROM gallery ORDER BY orderGallery DESC;";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo "SQL statement failed!";
} else {
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result)) {
echo '<a href="#">
<div style="background-image: url(img/gallery/'.$row["imgFullNameGallery"].');"></div>
<h3>'.$row["titleGallery"].'</h3>
<p>'.$row["descGallery"].'</p>
</a>';
}
}
?>