ill make it short so here the codes
my process in displaying BLOB images
- Code: Select all
<?php
//here's the code where i retrieve the image from database
require_once 'conff.php';
if (IsSet($_GET['Paint_ID'])){
$gotten = @mysql_query("select Image from paintings where Paint_ID = ".$_GET['Paint_ID']);
header("Content-type: image/jpeg");
while ($row = mysql_fetch_array($gotten)) {
print $row['Image'];
}
}
?>
here's the other one with <img tag>
- Code: Select all
<?php
//nothing special from here
error_reporting(0);
require_once 'conff.php';
require_once 'server.php';
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
//ssetting up another URL for painters
$cURL = curPageURL();
//$url = strpos($cURL,)
$sub = substr($cURL, -1); //get the last # of any page// <<--- until here, codes just to get the last # //of the URL
//paintings list
$query = mysql_query("SELECT * FROM paintings WHERE Paint_ID='".$sub."'");
$nums = mysql_num_rows($query);
if($nums == 0){ echo '</br>'.'no photo'; } else if($nums >= 1) {
while(($rows = mysql_fetch_assoc($query))) {
$paint = $rows['Image'];
$title = $rows['Title'];
$size = $rows['Medium'];
$medium = $rows['Size'];
echo '<td class="paintings_gallery"><a href="show.php?ID='.$sub.'" rel="lightbox" class="paints"><img class="images" src="show.php?Paint_ID='.$rows['Paint_ID'].'" width="150" alt="Paintings" />'.$title.'</br>'.$medium.'</br>'.$size.'</a></td>';
}
}
?>
to be honest, my code is working perfectly fine, the only problem is i cant display all the image regarding on their 'Paint_ID for example
i click the artist name 'Artist' which contain 4 paintings with a paint_id = 4, my webpage displays 4 images but all images only show the 1st image in paint#4, hope you guys get my point. Thanks in advance.