【发布时间】:2016-05-25 15:35:13
【问题描述】:
我使用此代码将表格中的图片放入使用 jquery 作为幻灯片动画的 div 中,但问题是我只需要在图片上而不是同时在所有图片上?我能做些什么 ? 代码:
<?php
require_once 'includes/connect.php';
$stmt = $bdd->prepare('SELECT userPic FROM AddOffer WHERE id_user=:id ORDER BY id_user DESC');
$stmt->bindParam(':id',$id);
$stmt->execute();
if($stmt->rowCount() > 0)
{
while($row=$stmt->fetchColumn())
{
extract($row);
?>
<img src="user_offers/<?php echo $row['userPic']; ?>" class="img-roundeds" width="200px" height="200px" />
<?php
}
}
else
{
?>
<span> Ajouter une Photo à votre Profil</span>
<?php
}
?>
【问题讨论】:
-
研究使用 LIMIT 为 1 的分页。
-
并学会使用
sprintf或更好的模板引擎来清理代码。