Here don't know why image is not being displayed in php, I think this line has some problem.
echo '<img src="' . $row['pic'] . '">';
the full code is like this
<?php
$result = mysqli_query($con, "SELECT name, email, branch, batch, position, pic FROM users ");
while ($row = mysqli_fetch_array($result)) {
echo '<section>'
. '<header>'
. '<h2>' . $row['name'] . '</h2>'
. '<p><span class="posted">'
. '<br>'
. $row['batch']
. '<br>'
. $row['branch']
. '<br>'
. $row['email']
. '<br>'
. 'Profession:'
. $row['position']
. '</header>'
. '</section>'
. '</div>'
;
}
echo '<img src="' . $row['pic'] . '">';
?>
Your while(){}
loop will run while mysqli_fetch_array()
returns arrays with information.
In the last iteration, mysqli_fetch_array()
will return NULL
and the loop will stop.
At this point $row['pic']
is not set. In fact $row
is no longer an array at all. $row
is NULL
.