0
<img class="image" src="./uploads/<?php echo $row['image_url']; ?>" width="300px" height="280px" alt="Movie poster"> 

in this img tag the php code is not working. Hence it is unable to generate the image url from database and as a result cannot display the image. So it is just showing the alter message.

please solve this problem

I want to show the image in my webpage

KIKO Software
  • 15,283
  • 3
  • 18
  • 33
Tasnim
  • 1
  • 2
    Have you looked at the produced HTML source code in your browser? What does it show? – KIKO Software May 15 '23 at 18:54
  • it is showing like this in inspected code – Tasnim May 15 '23 at 18:56
  • 5
    Then the problem is that `$row['image_url']` isn't set as you expect. What does `var_dump($row)` show? – Barmar May 15 '23 at 19:00
  • 4
    I see 2 possibilities: 1. `$row['image_url'];` does not exist. 2. `$row['image_url'];` contains an empty string. To see warning when it doesn't exist [switch on PHP error reporting](https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display) or check the PHP error logs. – KIKO Software May 15 '23 at 19:01
  • var_dump($row) is showing null – Tasnim May 16 '23 at 05:17
  • That means `$row['image_url']` doesn;t exist. – KIKO Software May 16 '23 at 06:36
  • Don't program in an naive way. Before using `$row` you must verify that `$row` has data. One other thing, try to avoid mixing PHP/HTML blocks, which makes code hard to read. You can use `printf()` or `sprintf()` to build HTML content in a php block and in some cases reuse repeating elements. – A. Cedano May 17 '23 at 14:10

0 Answers0