来自数据库的图像不会出现在php中

时间:2014-11-25 21:10:58

标签: php mysql database image

我试图在div标签中调用一些图像。所有其他变量都显示出来,但只有图像不会显示出来。任何人都可以指出错误吗?这是代码。

<div class="row">
        <?php
            include "config/database.php";
            $sql = "SELECT * FROM anidata";
            $query = mysql_query($sql);
            if ($query > 0){
        ?>
      <div class="col-sm-6 col-md-4" >
        <div class="thumbnail" >
            <?php
                while($row = mysql_fetch_array($query)){
                    $image = $row['image'];
                    $title = $row['title'];
                    $genre = $row['genre'];
                    $start = $row['start'];
                    $schedule = $row['schedule'];
                    $description = $row['description'];
                }
            ?>
        <div>
          <img src="<?php echo $row["image"]; ?>" width="194" height="272">
        </div>

          <div class="caption">
            <span style="font-size:18px;"><?php echo $title; ?></span>
            <div class="line-title">
            </div>
            <div class="description">
                <span style="font-size:12px;"><?php echo $description; ?></span>
            </div>

            <div class="genre">
                <span><?php echo $genre; ?></span>
            </div>
          </div>
        </div>
        <?php } ?>
      </div>

1 个答案:

答案 0 :(得分:0)

你必须做

 <img src="<?php echo $image; ?>" width="194" height="272">

取代&#34; $ row [&#34; image&#34;]&#34;