Hi. After watching a search engine tutorial, i decided to edit the codes for my project which is an Image Search Engine. users are supposed to type in a query and the system displays the images. My problem is that each time i enter a search query, the system only displays a file name instead of the image. I dont know what causes this problem so i would like you guys to help me out pleaseeeeee. NB. i have an image table in my database, and in the image column, i used a Varchar type & store the image file name. here are my codes: ` imageindex.php <html> <style type="text/css"> body { background-color: #000; } body,td,th { color: #FFF; } </style> <form action = 'imagesearch.php' method = 'GET''> <center> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><font size="5">BICT IMAGE DICTIONARY</font><font size="5" face="sans serif"><br> <input type = 'text' size = '50' name = 'search'> <input type = 'submit' name= 'submit' value = 'search'> </font></p> </center> </form> </html> PHP: imagesearch.php <style type="text/css"> body { background-color: #FFF; } </style> <?php //get data $button = $_GET['submit']; $search = $_GET['search']; $x = ""; $construct = ""; if (!$button){ echo "You didint submit a keyword."; } else{ if (strlen($search)<=2) { echo "Search term too short."; } else { echo "You searched for <b>$search</b><hr size='1'>"; //connect to database mysql_connect("localhost","root",""); mysql_select_db("imagedatabase"); //explode our search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //constuct query $x++; if ($x==1) { $construct .= "keywords LIKE '%$search_each%'"; } else { $construct .= " OR keywords LIKE '%$search_each%'"; } } //echo out construct $construct = "SELECT * FROM images WHERE $construct"; $run = mysql_query($construct) or die(mysql_error()); $foundnum = mysql_num_rows($run); if ($foundnum==0) { echo "No results found."; } else { echo "$foundnum results found!<p>"; while ($runrows = mysql_fetch_assoc($run)) { //get data $name = $runrows['name']; $image = $runrows['image']; echo " <b>$name</b><br> $image<br> "; } } } } PHP:
Chances are you need something like the following in the last part of your script: echo " <b>$name</b><br> <img src=\"$image\"><br> "; Code (markup):