Page 1 of 1

php mysql: images not displayed, help please....

Posted: Fri Feb 20, 2009 8:44 pm
by ecxzqute
gud day everyone!

i have this weird problem in displaying images in my page using php and mysql,
what is stored in my db is just the filename of the image. when i was developing this in my
local pc this had worked perfectly but when i uploaded it on the web something wrong happended,images didn't appeared... can anybody help me please?. :banghead:

here's the code of my query:

Code: Select all

 
 
//this is saved as a file called bus_showBus_query.php
<?php
    include"../includes/connect.php";               
                
    $sql = "SELECT * FROM business WHERE bus_id = '$_GET[bid]'";
    $result = mysqli_query($cxn,$sql) or die ("Unable to retrieve information!!.");
    
    mysqli_close($cxn);     
?>
 
//and here's the code to display the retrieved info from my db..
<?php
    include"../includes/bus_showBus_query.php"; 
    
     while($row = mysqli_fetch_assoc($result)){
     extract($row);
 
     /* here is the place where i have had the problem where the image does not appear*/
     echo "<tr>
          <img src='../images/business/{$row['img']}' class='no-border' height='400' width='430'>
     </tr>";
      
   /*this part here works just fine*/
     echo "<tr> <td align='left' bgcolor='#99CCCC' width='100%'>
     <p align='left'><b>Business Name :</b> {$row['bus_name']} </p> 
     <p align='left'><b>Business Type :</b> {$row['bus_type']} </p>
     <p align='left'><b>Business Address :</b> {$row['bus_address']} </p>
     <p align='left'><b>Business Manager/Proprietor :</b> {$row['bus_proprtor']} </p>
    <p align='left'><b>Business Remarks :</b> {$row['remarks']} </p> ";    
     echo "</td></tr>";
               
     }//end of while loop
?>
 
can anybody help me please?...

Re: PHP MYSQL: IMAGES NOT DISPLAYED!!!?? hELP....

Posted: Fri Feb 20, 2009 8:58 pm
by Bill H
Well, you might get better help if you do a couple of thigs:
1. Post in the right forum; this is a code question in the Gen'l Discussion forum
2. Don't shout. Use of all capitals is shouting and it makes people's eyes hurt.
Just a suggestion.

Re: PHP MYSQL: IMAGES NOT DISPLAYED!!!?? hELP....

Posted: Fri Feb 20, 2009 10:07 pm
by ecxzqute
ok, sorry for the shouting coz i didn't know using capitals means that way, any way, i just really need to figure out what is wrong with my code.. i really need help.

Re: php mysql: images not displayed, help please....

Posted: Sat Feb 21, 2009 12:07 am
by Bill H
My guess would be your path to the image files is in error, but there's no way to tell from what you have provided.

Re: php mysql: images not displayed, help please....

Posted: Sat Feb 21, 2009 12:12 am
by susrisha

Code: Select all

 
if(file_exists(../images/business/{$row['img']}))
{
 echo 'file exists';
}
else
{
echo 'error in getting image location';
echo "../images/business/{$row['img']}";
}
 
Try to find if the file actually exists in the system with the above code. Let us know if there has been an error or success

Re: php mysql: images not displayed, help please....

Posted: Sun Feb 22, 2009 8:19 am
by ecxzqute
the image directory is ok... i have checked it but to display it is the problem

Re: php mysql: images not displayed, help please....

Posted: Tue Feb 24, 2009 10:11 am
by susrisha

Code: Select all

 
[color=#FF0000]<img src='../images/business/{$row['img']}' class='no-border' height='400' width='430'>[/color]
 
<img src='../images/business/$row['img']' class='no-border' height='400' width='430'>
//May be this will help.. just give it a try.. i am not sure if that works..
 

Re: php mysql: images not displayed, help please....

Posted: Sat Mar 07, 2009 8:36 am
by ecxzqute
anyway,, i've solved this problem.. :),, just a matter of file names and extensions... thanx for the ideas too mr susrisha