fetch_assoc() error on Boolean

Asked

Viewed 31 times

1

I have this error in my application:

Call to a Member Function fetch_assoc() on Boolean

Running the same application on the local server and returns no error, on the dist server, returns the above error.

Error is generated on this line:

<?php
$photos = $conexao->query("SELECT * FROM images WHERE galeria_id = {$album_id}");
while($photo_data = $photos->fetch_assoc()) { ?>
    <div class="col-lg-4">
     <div class="thumbnail">
    <img class="img-responsive" src="admin/webroot/img/galerias/<?php echo $album_id; ?>/<?php echo $photo_data['image'] ?>" />
                        </div>
            </div>
        <?php } ?>
  • The point that must have generated this error is {$album_id} be null/empty

  • the $conexão->query(...) returns false if the query fails. Probably your album_id is null, empty or a string, and so the error occurs.

  • I was giving error for not receiving the attribute get that came from another page.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.