Menu

Convert Php Code Bind Fetch Commands Rather Getresults Q43813854

Convert this php code into bind and fetch commands rather thanget_results()

<?php
include_once ‘includes/dbh.inc.php’;

$sql = “SELECT * FROM gallery ORDER BY orderGalleryDESC;”;
  
$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, $conn);

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>’;
}
}
?>

Expert Answer


Answer to Convert this php code into bind and fetch commands rather than get_results() …

OR