Kort svar
Helt enkelt echo
ut URL:en till bilden i src
attribut och bilden kommer att visas.
<img id="result_img" src="<?php echo $imagelink; ?>" />
Fungerad lösning:
Bordsdesign:
images
| id | title | link | imagelink | description |
------------------------------------------------------------------------
| 1 | Some Title | http://www.google.com | myimage1.png | Some text |
------------------------------------------------------------------------
| 2 | My Title | http://www.yahoo.com | myimage2.png | Some text |
SQL-fråga
SELECT title, link, imagelink, description FROM images WHERE id = ?
PHP
<?php
$stmt = $mysqli->prepare("SELECT title, link, imagelink, description FROM images WHERE ID = ?");
$stmt->bind_param("i", $ID);
$stmt->execute();
$stmt->bind_result($title,$link,$imagelink,$description);
$stmt->fetch();
?>
<div class="pagination" style="display:inline">
<ul style="background-color:#">
<li><div class="span3_search">
<h2><a href='<?php echo $link; ?>'><b><?php echo $title; ?></b></a></h2>
<br />
<img id="result_img" src="<?php echo $link; ?>" />
<br />
<?php echo $description; ?>
<br />
<a href='<?php echo $link; ?>'><?php echo $link; ?><br /><br /></a>
<p></div>
</li>
</ul>
</div>