So I've got images' path stored in my database for each object and I want to display the images on my webpage. I though i could do it for each element with following code:
<?php
$con=mysqli_connect("x","x","x","x");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT imagesource FROM staff WHERE id=1");
echo '<img id="steve" src="'. $result . '"' . 'alt="Steve" class="thumbnail" />';
mysqli_close($con);
?>
<?php
$con=mysqli_connect("x","x","x","x");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT imagesource FROM staff WHERE id=1");
echo '<img id="steve" src="'. $result . '"' . 'alt="Steve" class="thumbnail" />';
mysqli_close($con);
?>