Jump to content

Links to images do not display from a PHP variable correctly


xenoalien

Recommended Posts

Okay, here is part of my code. It displays right in Google Chrome but no Firefox or IE.

 

                if($row['filetype']=='mp3')
                         {$fileiconpath = $websitelink.'images/icons/music.png';}
                         else
                         {$fileiconpath = 'images/icons/page.png';}
                         //==================================================

                 echo "</td><td>";
                 echo "<center><img src="".$fileiconpath.""></center>";
                 echo "</td></tr>";

Here's how I'd do this

echo $websitelink; // to make sure it's right    see if it has the trailing / or not
if($row['filetype']=='mp3')
                         {$fileiconpath = $websitelink.'images/icons/music.png';}
                         else
                         {$fileiconpath = 'images/icons/page.png';}
                         //==================================================
                  echo $fileiconpath; // just to make sure it looks right 
                     echo "</td><td>";
                    echo "<center><img src='".$fileiconpath."'></center>"; 
                    echo "</td></tr>";

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.