0

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetchAll() in C:\xampp\htdocs\RENT\component\test-folder\test.php:10 Stack trace: #0 {main} thrown in C:\xampp\htdocs\RENT\component\test-folder\test.php on line 10

    <?php
      include('constant.php'); 

      # getting images
      $sql = "SELECT image_name FROM image_upload ORDER BY id DESC";
      $stmt = $conn->prepare($sql);
      $stmt ->execute();
    

      $images = $stmt->fetchAll();
    

  ?>


<body>
        <form method="post" action="upload.php" enctype="multipart/form-data">

        <?php
            if(isset($_GET['error'])){
                echo "<p class='error'>";
                    echo htmlspecialchars($_GET['error']);
                echo "</p>";
            }
        ?>

        <input type="file" name="images[]" multiple>
        <button type="submit" name="upload">Upload</button>

        </form>
            <?php if ($stmt->rowCount() > 0) {  ?>
        <div class="gallery">
            <h4>All Images</h4>
            <?php foreach ($images as $image){ ?>
                <img src="image/<?=$image['image_name']?>">
                <?php }}?>
            </div>
    
    </body>
Bishop
  • 13
  • 5

0 Answers0