*Following up from a previous post Server connection failed
<?php
$servername = "localhost:3306";
$username = "brazen_test_gallary";
$password = "1234";
$dbname = "brazen_galleryexample";
$conn = mysqli_connect($servername, $username, $password, $dbname);
On my previous post, I was advised to remove the port number "3306" from the server name but that resulted in the following error :
Fatal error : Uncaught Error: Call to undefined function mysqli_stmt_get_result()
The lines that the error directed me to are written below:
<?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>';
}
}
?>
I looked at similar errors on StackOverflow, some of them said to update the PHP version on Cpanel. I tried that but no change. I want to establish a connection with my server in Hostgator but this error is not letting that happen.