Jump to content

Recommended Posts

Need some help:

 

This code works fine...all images appear:

while($row = mysql_fetch_array($result))
{
$photo = "<a href=http://www.website.com/images/items/" . $row['picture'] . " target=_blank><img src=http://www.website.com/images/items/" . $row['picture'] . " height=20% width=20% border=0></a><br>";
echo $photo;
echo "<b>Item #: " . $row[item] . "</b><br>";
echo "<b>" . $row[desc] . "</b><br>";
echo "<b>$" . $row[retail] . ".00</b><br>";
} 

 

There are 100's of records, so I want to put into a table so it show up nice.  However, when I add the table code, the images disappear.  Everything else if fine.

echo "<table><tr><td>";


while($row = mysql_fetch_array($result))
{
$photo = "<a href=http://www.website.com/images/items/" . $row['picture'] . " target=_blank><img src=http://www.website.com/images/items/" . $row['picture'] . " height=20% width=20% border=0></a><br>";
echo $photo;
echo "<b>Item #: " . $row[item] . "</b><br>";
echo "<b>" . $row[desc] . "</b><br>";
echo "<b>$" . $row[retail] . ".00</b><br>";
} 


echo "</td></tr></table>";

Link to comment
https://forums.phpfreaks.com/topic/166727-solved-image-in-table-not-appearing/
Share on other sites

try this,

echo "<table><tr><td>";
echo "<tr><td>testing</td></tr>";
while($row = mysql_fetch_array($result))
{
$img = urlencode($row['picture']);
   $photo = "<a href=\"http://www.website.com/images/items/$img\" target=\"_blank\"><img src\"=http://www.website.com/images/items/$img\" height=\"20%\" width=\"20%\" border=\"0\"></a><br>";
   echo $photo;
   echo "<b>Item #: " . $row['item'] . "</b><br>";
   echo "<b>" . $row['desc'] . "</b><br>";
   echo "<b>$" . $row['retail'] . ".00</b><br>";
}
echo "</td></tr></table>";

 

Just to confirm, does this work?

 

#echo "<table><tr><td>";


while($row = mysql_fetch_array($result))
{
   $photo = "<a href=http://www.website.com/images/items/" . $row['picture'] . " target=_blank><img src=http://www.website.com/images/items/" . $row['picture'] . " height=20% width=20% border=0></a><br>";
   echo $photo;
   echo "<b>Item #: " . $row[item] . "</b><br>";
   echo "<b>" . $row[desc] . "</b><br>";
   echo "<b>$" . $row[retail] . ".00</b><br>";
}


#echo "</td></tr></table>";

The view source shows the img code, but the image does not appear on the website.  Again, if I take out the <table>, the image does appear.

 

<table><tr><td><img src=http://www.website.com/images/items/75149.gif height=15% width=15% border=0><br><b>Item #: 12345</b><br><b>kl jfdskfdsl ls</b><br><b>$25.00</b><br><img src=http://www.website.com/images/items/75149.gif height=15% width=15% border=0><br><b>Item #: 544556</b><br><b>ihfdsyuyfdshkjf hksj</b><br><b>$36.00</b><br><img src=http://www.website.com/images/items/75149.gif height=15% width=15% border=0><br><b>Item #: 41475</b><br><b>i dfyeui riuewui dfsa</b><br><b>$8.00</b><br><img src=http://www.website.com/images/items/75149.gif height=15% width=15% border=0><br><b>Item #: 48976</b><br><b>rjf dsh fwje hrwqhjf khkfyshjb fj.d</b><br><b>$45.00</b><br><img src=http://www.website.com/images/items/75149.gif height=15% width=15% border=0><br><b>Item #: 5644654</b><br><b>oifp diy fuiweh kfkjgy uisdhighdfaj,hoi</b><br><b>$18.00</b><br><img src=http://www.website.com/images/items/75149.gif height=15% width=15% border=0><br><b>Item #: 432498328</b><br><b>fj hdshf dashh fjk</b><br><b>$89.00</b><br><img src=http://www.website.com/images/items/75149.gif height=15% width=15% border=0><br><b>Item #: 4896324782</b><br><b>kjfhdfjkdsufjkdsk</b><br><b>$199.00</b><br></td></tr></table>

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.