Jump to content

Picture Problems


Clinton

Recommended Posts

I've been scouring the internet up and down and have found a lot of pieces about mysql, php, and pictures and have tried to put them together to form my code.... but... it's failing. So a couple of questions...

 

I've got this on the page (we will call showimage.php) I want to show the picture:

 

<h3><img src="getimage.php?name=<?php echo $username ?>" width=100 Height=125></h3>

 

I've got this on the getimage.php page:

 

<?php

include 'connect/project.htm';

$name = $_GET['name'];

$result=mysql_query("SELECT clogo FROM employers WHERE username='$name'") or die(mysql_error());
$row=mysql_fetch_object($result);
Header( "Content-type: image/png");
echo $row->content;
?>

 

Now, the showimage.php page is just displaying a broken link.

 

The getimage.php page is displaying the text "http://localhost/project/getimage.php?name=hunna03" as an image and not the actual image.

 

So the questions...

 

1) I am saving images as a BLOB in mysql. How do I know they are saving correctly? I can't find any way to see them in MySQL.

 

2) What am I doing wrong with this code?

 

Thanks.

Link to comment
Share on other sites

what are the columns in our table? cus you only select the 'clogo' column, but try to echo the 'content' column. try selecting the content column too:

 

$result=mysql_query("SELECT clogo,content FROM employers WHERE username='$name'") or die(mysql_error());

 

also...you probably don't want this line:

include 'connect/project.htm';

what is in the project.htm file?

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.