| | |
display image file from mysql databse using php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 2
Reputation:
Solved Threads: 0
I'm having a problem with displaying my profile images from a database .the upload works fine,but no image is displayed:Could you please help!
I have the following code which cant work:
1. main profile page has the following script:
<?php echo '<img src="XXXXX_XXX.php?id=$Current_Person_Id">';
---------------------------------------------------------------------------------
2.the image page has the following script:
$result = mysqli_query($link,"select * from person where Person_Id='1
$result = mysqli_query($link,"select * from XXX where Person_Id='$Current_Person_Id'");
////starting the inner validation
//else if($result){
$row_count=0;
while($row = mysqli_fetch_array($result))
{
//$row_color = ($row_count % 2) ? $color1 : $color2;
$content=$row['Photo_Content'];
$name=$row['Photo_Name'];
$type=$row['Photo_Type'];
$size=$row['Photo_Size'];
$row_count++;
}
header("Content-length
size");
header("Content-type
type");
header("Content-Disposition: inline; filename=$name");
//header('filename=$name');
//Content-Disposition: attachment;
echo $content;
Note:
The variables
size,$type,$name are stored in database too.
I'm able to print all of them except the content.
Could it be my php configuration orsomething to do with images?
I've attached the image icon displayed..here....
I have the following code which cant work:
1. main profile page has the following script:
<?php echo '<img src="XXXXX_XXX.php?id=$Current_Person_Id">';
---------------------------------------------------------------------------------
2.the image page has the following script:
$result = mysqli_query($link,"select * from person where Person_Id='1
$result = mysqli_query($link,"select * from XXX where Person_Id='$Current_Person_Id'");
////starting the inner validation
//else if($result){
$row_count=0;
while($row = mysqli_fetch_array($result))
{
//$row_color = ($row_count % 2) ? $color1 : $color2;
$content=$row['Photo_Content'];
$name=$row['Photo_Name'];
$type=$row['Photo_Type'];
$size=$row['Photo_Size'];
$row_count++;
}
header("Content-length
size");header("Content-type
type");header("Content-Disposition: inline; filename=$name");
//header('filename=$name');
//Content-Disposition: attachment;
echo $content;
Note:
The variables
size,$type,$name are stored in database too.I'm able to print all of them except the content.
Could it be my php configuration orsomething to do with images?
I've attached the image icon displayed..here....
![]() |
Similar Threads
- display image from databse (MySQL)
Other Threads in the PHP Forum
- Previous Thread: Would the file size affect the upload?
- Next Thread: help, the browser gives an error
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





