Jump to content

[SOLVED] image not appearing in ie, but does in firefox


harlequeen

Recommended Posts

Hi All

 

Don't know if someone can help me with this.  I have some information which is output to a page in a table and one of the items is a picture which I have the url address of in the database.  In firefox, the picture displays, but does not in ie.  I'm a novice at php/mysql and can't see what the problem might be.

 

Here is my code (please note I'm trying to piece this together myself, so my code will be a bit wayward).

$sql=mysql_query("SELECT * FROM players ORDER BY `idnum` ");

while(@$row=mysql_fetch_array($sql)){

//Build formatted result here

echo "<table border=\"1\" class=\"trumptable\">";
echo("<h4>");
echo "<tr ><th colspan=\"2\">";
echo  $row['firstName']; 
echo (" ");
echo $row['lastName']."<br/>";"</th></tr>";
echo "<tr><td colspan=\"2\">";


echo '<center><img src="http://www.morganite-netball-club.co.uk/images/playerpics/' . $row['playerimg'] . '" height=\"280\" width=\"400\"></center><br/>';  
echo "</td></tr>";

echo "<tr><td>";
echo "Position : </td><td>";
echo $row['position']."<br/>";"</td></tr>";
echo "<tr><td>";
echo "Profession : </td><td>";
echo $row['profession']."<br/>";"</td></tr>";
echo "<tr><td>";
echo "Fav Hobby : </td><td>";
echo $row['favhobby']."<br/>";"</td></tr>";
echo "<tr><td>";
echo "Fav Movie : </td><td> ";
echo $row['favmovie']."<br/>";"</td></tr>";
echo "<tr><td>";
echo "Fav Music :  </td><td>";
echo $row['favmusic']."<br/>";"</td></tr>";
echo "<tr><td>";
echo "Fav Book : </td><td>";
echo $row['favbook']."<br/>";"</td><td>";
echo "<tr><td>";
echo "Daddy or Chips :  </td><td>";
echo $row['daddy']."<br/>";"</td><td>";
echo "<tr><td>";
echo "Cheese of Chocolate :  </td><td>";
echo $row['cheese']."<br/>";"</td><td>";
echo "<tr><td>";
echo "Coke or Pepsi :  </td><td>";
echo $row['coke']."<br/>";"</td><td>";
echo "<tr><td>";
echo "Brad Pitt or George Clooney :   </td><td>";
echo $row['pitt']."<br/>";"</td>";
echo"</tr>";


echo "</table>";

 

Can anyone help please.

Try using this code;

 

$sql=mysql_query("SELECT * FROM `players` ORDER BY `idnum` ");

while($row=mysql_fetch_array($sql)) {

//Build formatted result here

echo '<table border="1" class="trumptable">';
echo'<h4>';
echo '<tr ><th colspan="2">';
echo  $row['firstName'];
echo ' ';
echo $row['lastName'].''<br/>';
echo '</th></tr>';
echo '<tr><td colspan="2">';


echo '<center><img src="http://www.morganite-netball-club.co.uk/images/playerpics/' . $row['playerimg'] . '" height=\"280\" width=\"400\"></center><br/>'; 
echo "</td></tr>";

echo "<tr><td>";
echo "Position : </td><td>";
echo $row['position']."<br/>";
echo "</td></tr>";
echo "<tr><td>";
echo "Profession : </td><td>";
echo $row['profession']."<br/>";
echo "</td></tr>";
echo "<tr><td>";
echo "Fav Hobby : </td><td>";
echo $row['favhobby']."<br/>";
echo "</td></tr>";
echo "<tr><td>";
echo "Fav Movie : </td><td> ";
echo $row['favmovie']."<br/>";
ech "</td></tr>";
echo "<tr><td>";
echo "Fav Music :  </td><td>";
echo $row['favmusic']."<br/>";
echo "</td></tr>";
echo "<tr><td>";
echo "Fav Book : </td><td>";
echo $row['favbook']."<br/>";
echo "</td><td>";
echo "<tr><td>";
echo "Daddy or Chips :  </td><td>";
echo $row['daddy']."<br/>";
echo "</td><td>";
echo "<tr><td>";
echo "Cheese of Chocolate :  </td><td>";
echo $row['cheese']."<br/>";
echo "</td><td>";
echo "<tr><td>";
echo "Coke or Pepsi :  </td><td>";
echo $row['coke']."<br/>";
echo "</td><td>";
echo "<tr><td>";
echo "Brad Pitt or George Clooney :   </td><td>";
echo $row['pitt']."<br/>";
echo "</td>";
echo "</tr>";


echo "</table>";

 

If that doesn't work post the html from a 'view source' on each browser

Hi

 

No, that code didn't work either.

 

Here is the relevant code from Firefox


<link rel="stylesheet" href="style/trumps.css" type="text/css" >
<table border="1" class="trumptable"><h4><tr ><th colspan="2">Susan Edwards<br/><tr><td colspan="2">
<center><img src="http://www.morganite-netball-club.co.uk/images/playerpics/testpic.jpg" height=\"280\" width=\"400\"></center>
<br/></td></tr>

 

and here is the same output code from IE.

<link rel="stylesheet" href="style/trumps.css" type="text/css" >
<table border="1" class="trumptable"><h4><tr ><th colspan="2">Susan Edwards<br/><tr><td colspan="2">
<center><img src="http://www.morganite-netball-club.co.uk/images/playerpics/testpic.jpg" height=\"280\" width=\"400\"></center>
<br/></td></tr>

 

any help would be appreciated.  It's baffling me!

 

Cheers

 

Harlequeen

Hi

 

I guess by your post that you can't size images like this within php code, is that it?  I've removed the /" bit of the code and it does display now in ie.  obviously, I didn't know that and it displays ok in firefox.  Anyway, thanks for the hint...

 

As I said, I don't know php and am trying to learn it.  In Firefox, the pics display centered, but not in IE.  How can I fix that?

 

Thanks again for the help.

 

 

No, it's not because you can't size images, but because the way you have your quotes:

echo '<center><img src="http://www.morganite-netball-club.co.uk/images/playerpics/' . $row['playerimg'] . '" height=\"280\" width=\"400\"></center><br/>';

You're trying to escape a double quote, when you're echoing with single quotes.

echo '<center><img src="http://www.morganite-netball-club.co.uk/images/playerpics/' . $row['playerimg'] . '" height="280" width="400"></center><br/>';

 

If you had done the following, you would have needed the escaping (as shown) :):

echo "<center><img src=\"http://www.morganite-netball-club.co.uk/images/playerpics/" . $row['playerimg'] . "\" height=\"280\" width=\"400\"></center><br/>";

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.