I am trying to do something easy I am sure but I have looked and tested and I am not doing something right. I have a DB that stores the image file name, I need to get the file name based on the ID in the HTML , let me explain:
<div class="slide">
<div class="image-holder">
<img src="img/asoft_table.jpg" alt="" />
</div>
<div class="info">
<p>Morbi a tellus lorem, id scelerisque ligula. Maecenas vitae turpis et.</p>
</div>
</div>
<div class="slide">
<div class="image-holder">
<img src="img/soft_table.jpg" alt="" />
</div>
<div class="info">
<p>Sed semper, lorem ac lobortis bibendum, magna neque varius augue, vel accumsan.</p>
</div>
</div>
<div class="slide">
<div class="image-holder">
<img src="img/living_room2.jpg" alt="" />
</div>
in each instance of an img tag, I need to insert the filename from the DB. so, first image tag would be primary key 1, second primary key 2 and so forth. Here is the PHP script I am using to retrieve the filename, which works, but I am unsure how to send the ID of the image to the script and then return it properly.
<?php
$hote = 'localhost';
$base = '*****';
$user = '*****';
$pass = '*****';
$cnx = mysql_connect ($hote, $user, $pass) or die(mysql_error ());
$ret = mysql_select_db ($base) or die (mysql_error ());
$image_id = mysql_real_escape_string($_GET['ID']);
$sql = "SELECT image FROM image_upload WHERE ID ='$image_id'";
$result = mysql_query($sql);
$image = mysql_result($result, 0);
header('Content-Type: text/html');
echo '<img src="' . $image . '"/>';
exit;
?>
any help would be appreciated, thanks a heap