473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

img display from mysql database needs help

tolkienarda
316 100+
hi all

I have this script that i found and modified slightly it appears to use some code i am not famalier with so trouble shooting has turned into a night mare but here is what i have

this part is on my page where i want the image displayed
[HTML]
<img src="imagedisp.php?title=asdf">
[/HTML]

here is the imagedisp.php page

[PHP]

$result = "SELECT imgdata, type FROM pix WHERE title='$title'";
$Show = mysql ( $hDB, $hSQL );
$rows = mysql_num_rows($hShow);

if($rows<1){
// no image matches this query
}
else{
// at least one image has this title
$getPhoto = mysql_fetch_object($Show);

// we need to determine the mime type
$Type = $getPhoto->type;

// and send the correct header to the browser
Header("Content-type: $Type");

// now send the image
$Body = $getPhoto->body;
echo $Body;
flush();
}
[/PHP]

thanks for any guidence

eric
Feb 15 '07 #1
3 1554
cassbiz
202 100+
hi all

I have this script that i found and modified slightly it appears to use some code i am not famalier with so trouble shooting has turned into a night mare but here is what i have

this part is on my page where i want the image displayed
[HTML]
<img src="imagedisp.php?title=asdf">
[/HTML]

here is the imagedisp.php page

[PHP]

$result = "SELECT imgdata, type FROM pix WHERE title='$title'";
$Show = mysql ( $hDB, $hSQL );
$rows = mysql_num_rows($hShow);

if($rows<1){
// no image matches this query
}
else{
// at least one image has this title
$getPhoto = mysql_fetch_object($Show);

// we need to determine the mime type
$Type = $getPhoto->type;

// and send the correct header to the browser
Header("Content-type: $Type");

// now send the image
$Body = $getPhoto->body;
echo $Body;
flush();
}
[/PHP]

thanks for any guidence

eric
Shooting in the dark here, but hope it helps,

Expand|Select|Wrap|Line Numbers
  1. <img src="<?php include=imagedisp.php?title=asdf ?>" />
  2.  
you have to be sure that the output is still an image (jpg, gif, png, etc...)
Feb 15 '07 #2
cassbiz
202 100+
oops wrote the include statement wrong.

Expand|Select|Wrap|Line Numbers
  1. <img src="<?php include imagedisp.php?title=asdf; ?>" />
  2.  
Feb 15 '07 #3
tolkienarda
316 100+
oops wrote the include statement wrong.

Expand|Select|Wrap|Line Numbers
  1. <img src="<?php include imagedisp.php?title=asdf; ?>" />
  2.  
thanks i will give it a shot and get back to you if it works or not

eirc
Feb 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: AF | last post by:
I am a real novice to php and MySQL, with about a week's worth of reading and self tutoring. I have an urgent need to publish a database of information and need some guidance on how to do this. ...
51
by: w_curtis | last post by:
I'm an Access user, and I'm trying to learn MySQL and then PHP so I can make some web databases. But it just isn't clicking. I've followed some tutorials, and picked up a book, but just getting...
1
by: ikrabbe | last post by:
Hi, I want to set up a mysql server in an embedded process. I managed to start the server in my program as described through mysql_server_init() Now I need a client connection to this...
17
by: chicha | last post by:
Hey people, I have to convert MS Access 2000 database into mysql database, the whole thing being part of this project I'm doing for one of my faculty classes. My professor somehow presumed I...
175
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
6
by: Mark | last post by:
Hello all, I have the following file.txt storing these kind of values: Name: John Doe E-mail: john@doe.com Phone: 555 865 8901 Address: 71 Huntington Ln. (33444) FL - Delray Beach US Member...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
6
by: Bill Nguyen | last post by:
I'm getting data from a mySQL database (default char set = UTF-8). I need to display data in Unicode but got only mongolian characters like this: Phạm Thị Ngọc I changed the textbox font to...
18
by: Bruce A. Julseth | last post by:
I have the following code $Host = "localhost"; $User = "Fred"; $Database = "house"; $Password = "mypw" echo "before mysqli<br />Host: " . $Host . "<br />" . $User . "<br />" . $Database;
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.