【发布时间】:2017-12-13 13:47:27
【问题描述】:
我想输出我在数据库中列出的视频。一切正常,但我看不到数据库中的所有条目。这是和伪输出:
Video4 Video3 Video2 Video1
当我在数据库中有 5 个条目时,输出如下:
Video5 Video4 Video3 Video2
Video1
但是现在我的问题开始了,当我有超过 5 个条目时,我看不到输出中的第一个条目(在网站上)。输出是这样的:
Video6 Video5 Video4 Video3
Video2
并且由于某种原因 Video1 被删除,当我按下 F12 (Chrome) 时我也看不到它。
这就是我的数据库的样子:
id description filename fileextension
1 Test1 Video1.mp4 mp4
2 Test2 Video2.mp4 mp4
3 Test3 Video3.mp4 mp4
4 Test4 Video4.mp4 mp4
5 Test5 Video5.mp4 mp4
6 Test6 Video6.mp4 mp4
以及输出代码:
<?php
$result= mysql_query( "SELECT description, filename, fileextension FROM video ORDER BY ID DESC LIMIT 5" )
or die("SELECT Error: ".mysql_error());
echo "<div class='scrollbar'>";
while ($row = mysql_fetch_array($result)){
echo "<div class='responsive'><div class='gallery'>";
$videos_field= $row['filename'];
$video_show= "Uploads/videos/$videos_field";
$descriptionvalue= $row['description'];
$fileextensionvalue= $row['fileextension'];
echo "<div class='desc'><font face=arial size=5 color=#CFB53B />$descriptionvalue</font></div>";
echo "<a><video controls><source src='$video_show' type='video/$fileextensionvalue'>Your browser does
not support the video tag.</video></a>";
echo "</div></div>";
}
echo "</div>";
?>
还有一些 CSS:
div.scrollbar{
width:100%;
height:720px;
overflow:auto;
}
div.gallery {
margin-left: 8px;
margin-right: 2px;
margin-top: 40px;
}
div.gallery video {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
border: 1px solid #ccc;
}
div.desc:hover {
border: 1px solid #CFB53B;
}
* {
box-sizing: border-box;
}
在第 6 个条目之后,从 1 到 5 的输出正常,我再也看不到第一个了。当我在数据库中有 7 个条目时,将删除 Video1 和 Video2。
我需要你们的帮助..
【问题讨论】: