Jump to content


Photo

PHP Image display problem


  • Please log in to reply
2 replies to this topic

#1 tet3828

tet3828
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts
  • Locationfort myers, FL

Posted 26 October 2006 - 04:18 PM

To the contributers so far... You guys rock, thanks again and again. Quick coding question...


I wonderful and helpfull  script posted by Orio but Im having trouble getting the image to show
I have commented the problem area. The link to my image is in a mySQL table and instead of showing the image its showing the code. What the deal here?

<?php

if(!isset($_POST['submit']))
{
die("<html><body><form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">
<select name=\"cat\">
<option value=\"Holiday\">Holiday</option>
<option value=\"Animals\">Animals</option>
</select>
<input type=\"submit\" name=\"submit\" value=\"Search!\">
</form>
</body>
</html>");
}


$qry = "SELECT itemName,itemPrice,itemSmall FROM `products` WHERE itemCat='".$_POST['cat']."'";
$result = mysql_query($qry) or die(mysql_error());

echo "<table border=\"1\"><tr><td>Name</td><td>Price</td><td>Thumbnail</td></tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>".$row['itemName']."</td>";
echo "<td>".$row['itemPrice']."</td>";
echo "<td><img src=\"".$row['itemSmall']." /></td>";                  \\\itemSmall is the location of my thumbnail on the server
echo "</tr>";
}

echo "</table>";
[ Enter Your Signature Here ]
Always take caution when using other peoples work.

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 26 October 2006 - 04:35 PM

I think that's my error.
Change this:
echo "<td><img src=\"".$row['itemSmall']." /></td>";

Into:
echo "<td><img src=\"".$row['itemSmall']."\" /></td>";


And you dont really need to open a new thread for every issue, you can reply if you have a problem :)

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 tet3828

tet3828
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts
  • Locationfort myers, FL

Posted 26 October 2006 - 04:48 PM

WOW thanks that worked like a charm...
PHP is a bear. all the "", / , \ ect.
how do you know where to put all that garbage.
I've got a 700 page php book Novice to Professional but pin pointing that information (if its in there) would have been Impossible.




[ Enter Your Signature Here ]
Always take caution when using other peoples work.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users