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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ecxzqute
Forum Commoner
Posts: 29
Joined: Tue Oct 14, 2008 12:26 am

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

Post 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?...
Last edited by ecxzqute on Fri Feb 20, 2009 10:20 pm, edited 1 time in total.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

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

Post 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.
ecxzqute
Forum Commoner
Posts: 29
Joined: Tue Oct 14, 2008 12:26 am

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

Post 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.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

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

Post 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.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

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

Post 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
ecxzqute
Forum Commoner
Posts: 29
Joined: Tue Oct 14, 2008 12:26 am

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

Post by ecxzqute »

the image directory is ok... i have checked it but to display it is the problem
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

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

Post 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..
 
ecxzqute
Forum Commoner
Posts: 29
Joined: Tue Oct 14, 2008 12:26 am

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

Post by ecxzqute »

anyway,, i've solved this problem.. :),, just a matter of file names and extensions... thanx for the ideas too mr susrisha
Post Reply