tharden3 Posted February 9, 2009 Share Posted February 9, 2009 hey PHPfreaks, I've just joined and I'm looking forward to expanding my knowledge with the help of all of you great people out there. Nice to meet you all. Here is my problem: I'm making a website with lists of products on it. It shows 10 or 12 products per page, and each product has 3 varchar fields (for the products information), and one BLOB field (for a product thumbnail). I can get the varchar fields to show up, but the BLOB field won't. "imgdata" is where the binary (BLOB) for the images are stored. Here is my code: $query = " SELECT * FROM air_registers" . " LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); while($row=mysql_fetch_array($result, MYSQL_ASSOC)){ $imgdata=$row["imgdata"]; $type=$row["Type"]; $number=$row["Number"]; $desc=$row["Description"]; echo "<div id='type'><strong>Model Type: </strong>$type</div>"; echo "<div id='number'><strong>Model #: </strong>$number</div>"; echo "<br />"; echo $imgdata; echo "<br />"; echo "<div id='desc'><strong>Description: </strong>$desc</div>"; echo "<br />"; echo "<hr>"; } Thanks for the help everyone. Quote Link to comment https://forums.phpfreaks.com/topic/144430-cant-get-blob-field-to-show-up/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 9, 2009 Share Posted February 9, 2009 Every image on a web page needs an <img src="url_of_the_image" alt=""> tag - http://w3schools.com/html/html_images.asp This is yet another reason why files should not be stored in databases. If your thumbnails were files stored in a folder, all you would need to do is put the URL of the thumbnail into the <img src="..." tag. Since you have files stored in a database, the URL that you put into the <img src="..." tag needs to be that of a .php file that queries the database and outputs the correct content type header for the image followed by the image data. Quote Link to comment https://forums.phpfreaks.com/topic/144430-cant-get-blob-field-to-show-up/#findComment-757900 Share on other sites More sharing options...
tharden3 Posted February 9, 2009 Author Share Posted February 9, 2009 Hey PFMaBiSmAd, thanks for the help. I've been told this before, but I have a lot of pictures, and it seemed necessary. At some point though, I need some sort of PHP script to run through either the images, or their address, and use an img tag. I'm not quite sure how to do this. Any suggestions? Thanks, Tim Quote Link to comment https://forums.phpfreaks.com/topic/144430-cant-get-blob-field-to-show-up/#findComment-757904 Share on other sites More sharing options...
tharden3 Posted February 9, 2009 Author Share Posted February 9, 2009 So I should upload the thumbnails using my file-manager on my host site? And then use my script to run through the addresses like "apples.jpg"? Quote Link to comment https://forums.phpfreaks.com/topic/144430-cant-get-blob-field-to-show-up/#findComment-757926 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.