June 18th, 2013, 03:06 AM
How to change the row size or make it dynamic to display image
hello guys, i have this working code below which should retrieve an image along with other details. it should display in a table. the image is not displaying well in the table. the row size stays fixed and does not change.
echo "<h2>Search Results:</h2><p>";
$find = $_POST['find'];
//If they did not enter a search term we give them an error
if ($find == "")
echo "<p>You forgot to enter a search term!!!";
// Otherwise we connect to our Database
// We perform a bit of filtering
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);
//Now we search for our search term, in the field the user specified
$data = mysql_query("SELECT * FROM tbl_product WHERE prod_name LIKE'%$find%'");
<table border=\"5\" cellpadding=\"5\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#808080\" width=\"100%\" id=\"AutoNumber2\" bgcolor=\"#C0C0C0\"><tr>
<td width=100>Product Details:</td>
//And we display the results
while($result = mysql_fetch_array( $data ))
print '<td><img src="Images/Products/'.$result['prod_photo'].'"/></td>';
print "<td>" . $result['prod_name'] . "</td>";
print "<td>" . $result['prod_brand'] ."</td>";
print "<td>" . $result['prod_desc'] . "</td>";
print "<td>" . $result['prod_price'] . "</td>";
print "<td>" . $result['prod_w_c'] . "</td>";
//This counts the number or results - and if there wasn't any it gives them a little message explaining that
if ($anymatches == 0)
echo "Sorry, but we can not find an entry to match your query...<br><br>";
//And we remind them what they searched for
echo "<b>Searched For:</b> " .$find;
the code works fine but the image is not displaying
June 18th, 2013, 09:21 AM
For the second time, stop creating new threads for this question.
Now that you've actually posted your whole code (unformatted, but we're apparently doing baby steps), there's a few comments:
1) You are using outdated database functions and you have no security on any of this, your code is a security nightmare and you should read the stickies.
2) according to everything you've said about this project, this SHOULD be working. However, do some debugging. View the source of this page and see what the image tag actually looks like.
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.