我有问题,我存储在数据库列(video_id)和它的值,如该商店(1,3,4,7),数字是指视频表中存储视频标题和文字的视频ID以及有关视频的所有信息,但当我编写代码来选择所有视频时,结果会给我一个视频
<div class="panel-body">
<?
$qu="SELECT video_id FROM `training_questions` WHERE id=$questions_id AND category_id=$training_id";
$query_c= mysqli_query($con, $qu);
while ($row7 = mysqli_fetch_assoc($query_c)) {
$vedoes=$row['video_id'];
$pieces = explode(",", $vedoes);
}
for($i=0;$i<=count($pieces);$i++){
$query = "SELECT * FROM `video` WHERE id IN $pieces[$i] ";
$query_che= mysqli_query($con, $query);
while ($row2 = mysqli_fetch_assoc($query_che)) { ?>
<div class="col-lg-3 col-sm-6">
<div class="thumbnail">
<div class="video-container">
<div class="thumb"> <a href="video_details.php?id=<?= $row2['id'] ?>"> <img src="../upload/<?= $row2['img'] ?>" class="img-responsive img-rounded media-preview" alt=""> <span class="zoom-image"><i class="icon-play3"></i></span> </a> </div>
</div>
<div class="caption">
<h6 class="no-margin">
<a href ="video_details.php?id=<?= $row2['id'] ?>" class="text-default"><?= $row2['title'] ?>
</a>
</h6>
</div>
</div>
</div>
<?
}
} ?>
</div>
我该如何解决?
答案 0 :(得分:0)
删除
$pieces = explode(",", $vedoes);
无用的
让你的for循环条件看起来像这样
for($i=0;$i<=count($vedoes);$i++)
希望它有助于