UPDATE:
I have have ten columns in my SQL table: id, imgid, urlid, image1, image2, image3, image4, image5, and comment. Id, imgid, and urlid are int type. Image[1-5] are mediumblob type. Url and comment are text type. Imgid is the number of images uploaded (which should be 5), urlid is the number of urls submitted (which should be one right now), url holds the url, and comment holds user comments. I'd like to retrieve and output all the image data from the image columns in a row but I'm getting torn page icons. I am using a front.php to output images and a get.php to convert images to viewable format.
Here's my front.php:
<?php
mysql_connect ("","","") or die(mysql_error());
mysql_select_db ("") or die(mysql_error());
$defaultqry = mysql_query ("SELECT * FROM dbp");
while($row = mysql_fetch_assoc($defaultqry))
{
echo ($row['image1'] != NULL) ? '<img src="get.php?id='.$row[id].'&col=1 " width="30" height="30"/> ' : '';
echo ($row['image2'] != NULL) ? '<img src="get.php?id='.$row[id].'&col=2 " width="30" height="30"/> ' : '';
echo ($row['image3'] != NULL) ? '<img src="get.php?id='.$row[id].'&col=3 " width="30" height="30"/> ' : '';
echo ($row['image4'] != NULL) ? '<img src="get.php?id='.$row[id].'&col=4 " width="30" height="30"/> ' : '';
echo ($row['image5'] != NULL) ? '<img src="get.php?id='.$row[id].'&col=5 " width="30" height="30"/> ' : '';
}
?>
Here's my get.php:
<?php
mysql_connect ("","","") or die(mysql_error());
mysql_select_db ("") or die(mysql_error());
$query = mysql_query("SELECT * FROM dbp WHERE id = ".mysql_real_escape_string($_GET['id']));
$row = mysql_fetch_array($query);
$col = intval($_GET['col']);
if(isset($row['image'.$col]) && $row['iamge'.$col] != NULL){
$content = $row['image'.$col];
}else{
exit; // col is not existent, or image is empty
}
header('Content-type: image/jpg');
echo $content;
exit;
?>