Jump to content

Archived

This topic is now archived and is closed to further replies.

tet3828

PHP Image display problem

Recommended Posts

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>";

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.



Share this post


Link to post
Share on other sites

×

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.