【发布时间】:2012-11-24 13:29:40
【问题描述】:
我想显示我所做的数据库中的 cmets,但是如果用户上传了一个,我还想添加评论的图像,目前我将图像存储在一个文件夹中,图像路径位于数据库旁边cmets 如果用户添加了带有评论的图像,但是它没有显示图像,并且它还在没有图像的 cmets 所在的位置创建图像空间,代码如下
<?php
include('../c_database.php');
$queryAll = "SELECT ID, Username, Comments, time_added FROM comments ORDER BY ID DESC";
$executeQuery = mysqli_query($dbc, $queryAll);
while($row = mysqli_fetch_array($executeQuery)){
echo '<div class="commentbox">';
echo '<div class="comments">';
echo '<fieldset class="comment">';
echo '<legend>';
echo $row['Username'];
echo '</legend>';
echo '<br>';
echo '<br>';
echo '<img src="'.$row['imagepath'].'" width="100px" height="100px"></img>';
echo ' ';
echo $row['Comments'];
echo '<br>';
echo '<br>';
echo '<div class="commentdetails">';
echo '<fieldset>';
echo $row['time_added'];
echo ' / ';
echo 'Comment ID: ';
echo $row['ID'];
echo '</div>';
echo '</fieldset>';
echo '</div>';
echo '<br>';
echo '</div>';
}
?>
那么我如何仅在用户上传的 cmets 中显示图像?
【问题讨论】: