by phmyway » Tue Mar 01, 2011 12:31 am
I hope you do not have a problem of inserting images in a table. You can get thumbnails or gallery of pictures from your database. However, note that I use a separate folder to keep the images and their pointers in the database. For example, the following code shows you that I have a table named audio_pics with all the columns as image_id and image_date. While fetching the image id and date from the table, it also anchors the image from a subfolder cd4car_images/thumbs/.
<?php
//get the thumbs
$getpic = mysql_query("SELECT * FROM audio_pics")
or die(mysql_error());
$records = mysql_num_rows($getpic);
while($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"../cd4car_images/thumbs/$image_id.jpg\" >";//this href is anchored to the image below
echo "<img src=\"../cd4car_images/thumbs/$image_id.jpg\" >";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "</tr>\n";
}
if ($records == 0) echo "No results found. Please try again";
?>
Let me hear from you, if I have to explain more.