Quantcast
Channel: MySQL Forums - PHP
Viewing all articles
Browse latest Browse all 938

pictures from database (1 reply)

$
0
0
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);
?>

Viewing all articles
Browse latest Browse all 938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>