Images from MySQL Not Displaying

I’m recently having difficulty with my image pages. Everything has been working perfectly until recently and I’m not sure I did anything since I haven’t messed with the code. If anyone has any suggestions, I thank you very much in advance for any tidbits.

Here is how I’m calling the page:

Here are sample issues:

Here is the view_image.php code:

<?php if($id) { $cat = $_REQUEST['cattype']; $id = $_REQUEST['id']; // you may have to modify login information for your database server: @MYSQL_CONNECT("xxx","xxx","xxx"); mysql_select_db("xxx"); $query = "select bin_data,filetype,display_id,cat_type from image_display where display_id='$id' AND cat_type='$cat'"; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"bin_data"); $type = @MYSQL_RESULT($result,0,"filetype"); Header( "Content-type: $type"); echo ($data); }; ?>


[size=99px]**Mod edit - Added PHP tags for readablity.[/size]

Well, from the link you provided, that error is telling me you are missing or the path to a page named main is wrong.

try to handle mysql errors:
$result = @MYSQL_QUERY($query);
if (mysql_errno())

I reviewed your live example ( and didn’t saw changed header.
So, try to see $type and $data values with var_dump().

Images is stored in binary MySQL fields.

Why would you want to store the images in the database? It is much easier to store them on the filesystem (much easier to serve as well).

problems with permission

Sponsor our Newsletter | Privacy Policy | Terms of Service