我正在尝试使用与单击的缩略图相对应的视频来下拉完整的覆盖屏幕。如果未选择任何视频,并且有空白,无法正常播放的视频,则该视频将起作用。但是,当我尝试将视频分配给视频的ID($ v_id)时,它将返回错误。
通知:未定义索引:v_id
<?php
include "filing.php";
$v_id = $_SESSION['v_id'];
$Myquery=mysqli_query($link, "SELECT video_name FROM video WHERE v_id='$v_id'";
$my_video=mysqli_fetch_array($Myquery);
?>
<!-- The overlay -->
<div id="myNav" class="overlay">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">× </a>
<!-- Overlay content -->
<div class="overlay-content">
<video width="60%" height="90%" style="background-color:#585858; border: 4px solid darkorange; border-radius:20px;" controls>
<source src="uploads/<?php echo $my_video['video_name']; ?>" type="video/mp4">
</video>
</div>
</div>
在下面单击缩略图。
<?php
$query=mysqli_query($link, "SELECT * FROM video ORDER BY RAND() LIMIT 5");
while($all_video=mysqli_fetch_array($query)){
?>
<a href="javascript:;" onclick="openNav()"><image src="thumbnails/<?php echo $all_video['image_name']; ?>" width="300" height="200"/></a>
<script type="text/javascript">
function openNav() {
document.getElementById("myNav").style.height = "100%";
}
function closeNav() {
document.getElementById("myNav").style.height = "0%";
}
</script>
<?php } ?>
下面是mySQL
CREATE TABLE video(
v_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
video_name VARCHAR(225) NOT NULL,
id INT NOT NULL,
FOREIGN KEY user_id(id)
REFERENCES users(id)
ON DELETE CASCADE,
n_views INT,
image_name VARCHAR(225) NOT NULL
);