Jump to content

PHP Image display problem


tet3828

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>";
Link to comment
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.
Link to comment
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.



Link to comment
Share on other sites

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.