Page 2 of 2 First 12
  • Jump to page:
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Rep Power

    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%'");

    print "
    <table border=\"5\" cellpadding=\"5\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#808080\" width=\"100&#37;\" id=\"AutoNumber2\" bgcolor=\"#C0C0C0\"><tr>
    <td width=100>Product</td>
    <td width=100>Name:</td>
    <td width=100>Brand:</td>
    <td width=100>Product Details:</td>
    <td width=100>Price:</td>
    <td width=100>Weight:</td>

    //And we display the results
    while($result = mysql_fetch_array( $data ))

    print "<tr>";
    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>";
    print "</tr>";
    print "</table>";

    //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
  2. #17
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Pennsylvania, USA
    Rep Power
    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.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo