2012-07-10 40 views
0
<?php 
require 'db.php'; 
include_once("header.php"); 
include_once("functions.php"); 


if(isset($_POST['search_term'])){ 
    $search_term = mysql_real_escape_string(htmlentities ($_POST['search_term'])); 

    if(!empty($search_term)){ 

     $search = mysql_query("SELECT users.username, users.id, tbl_image.photo, tbl_image.userid FROM users LEFT OUTER JOIN tbl_image ON users.id=tbl_image.userid WHERE users.username LIKE '%$search_term%' and users.business <> 'business'"); 


     $result_count = mysql_num_rows($search); 



     $suffix = ($result_count != 1) ? 's' : ''; 


     echo '<div data-theme="a">Your search for <strong>' , $search_term ,'</strong> returned <strong>', $result_count,' </strong> record', $suffix, '</div>'; 



     while($results_row = mysql_fetch_assoc($search)){ 
      echo '<div data-theme="a"><strong>',$results_row['photo'], $results_row['username'], '</strong></div>'; 



$following = following($_SESSION['userid']); 


    if (in_array($key,$following)){ 
     echo ' <div action= "action.php" method="GET" data-theme="a"> 
     <input type="hidden" name="id" value="$key"/> 
     <input type="submit" name="do" value="follow" data-theme="a"/> 
</div>'; 

    }else{ 
     echo " <div action='action.php' method='GET' data-theme='a'> 
     <input type='hidden' name='id' value='$key'/> 
     <input type='submit' name='do' value='follow' data-theme='a'/> 
     </div>"; 

} 

} 

     } 

} 

?> 

如何獲取要在頁面上顯示的實際圖像而不是圖像的名稱。我在名爲image的文件夾下有文件系統中的圖像。我如何在屏幕上回顯該圖像,或者如果回聲不是正確的方法,你會怎麼做?如何讓我的網頁上顯示實際圖像而不是文本?

回答

1

您的意思是這樣的?

echo '<img src="'.$results_row['photo'].'" width="80">'; 
+0

不完全,這只是給了我一個破碎的形象。我必須引用圖像所在的文件系統文件夾。 – Steven 2012-07-10 02:43:46

+0

然後在圖像中找到文件,就像這個'' – 2012-07-10 02:45:55

+0

好吧,那很好,最後一個問題。你如何改變標籤中圖像的大小? – Steven 2012-07-10 02:51:26

相關問題