如何在我的页面上显示实际图像而不是文本?

时间:2012-07-10 02:37:42

标签: image echo

<?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 个答案:

答案 0 :(得分:1)

你的意思是这样吗?

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