Jump to content

Problem with displaying a Long Blob


mark110384

Recommended Posts

The problem is that I cannot display a long blob for some reason, it just display anything and when you select view image the url is displayed like so

 

http://localhost/example/cart/image.php?item_id=%20F0800

 

I send the itemId that will be referenced to the image through the URL using this code.

 

echo "<img src='image.php?item_id= $itemid'>";

 

I then get the ID and check the database, but it just doesn't display the image! Can anyone please help. Any suggestions will be welcomed and appreciated.

 

<?

header('Content-Type: image/jpeg');

 

 

$dbhost = "*****";

$dbuser = "****";

$dbname = "****";

 

$itemid = $_GET["item_id"];

 

 

 

$dbconnect = mysql_connect("$dbhost", "$dbuser")or die("Could not connect to database");

 

mysql_select_db("$dbname") or die("Could not select db");

 

$sql = "SELECT image FROM items WHERE itemId = '$itemid'";

 

$result = mysql_query($sql, $dbconnect);

 

$row = mysql_fetch_array($result);

 

$sJpg = $row["image"];

 

echo $sJpg;

 

?>

 

 

 

Link to comment
Share on other sites

so you are storing the picture inside, right?

 

you may alternatively store the picture as a file and store in the database the path and the filename instead. that way, the database will not easily get bloated. and the query will run faster.

 

just a suggestion though that you might want to try. :)

 

Jay,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.