使用php从数据库检索图像时出现问题

时间:2014-04-28 10:19:47

标签: php mysql

我正在尝试从数据库中检索五个图像并以单行显示这些图像。我的代码正在检索所有图像'数据但不是图像本身。我做错了什么?

这是我的代码:

<?php
        include "config.php";


        $q = mysql_query("SELECT * FROM register r
                          JOIN videos v ON r.id = v.video_id
                          ORDER BY r.id desc LIMIT 5") or die (mysql_error());

        $headers = $col = "";
        $row=mysql_num_rows($q);
        $s=null;

        while ($row = mysql_fetch_array($q)) 
        {
        if($row['id']!=$s)
        {
        $s = $row['id'];


        echo "<div class='property'>";
        echo "<div class='property1' >";
        echo "<a href='#'><img src='".$row['path']."' height='100' width='170' style= margin:5px;></a>";
        echo "</div>";
        echo "<div class='property2'>";
        echo $row['videoname'];
        echo "</div>";
        echo "<div class='property3'>";
        echo "<br/>";
        echo "by:";
        echo $row['name'];
        echo "<br/>";
        echo "</div>";
        echo "<div class='property4'>";
        echo $row['views'].'&nbsp;&nbsp;views&nbsp;';
        echo $row['time'].'&nbsp;&nbsp;year ago';
        echo "</div>";


        echo "</div>";

        }
        }
        ?>

0 个答案:

没有答案