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
https://forums.phpfreaks.com/topic/139569-picture-problems/
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
https://forums.phpfreaks.com/topic/139569-picture-problems/#findComment-730134
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.