我正在制作一个包含我上传到数据库的每个视频的页面。
按日期过滤,按日期排序。每个带JavaScript的视频都有一个onclick。它必须在网站上显示所有价值。
但是当我点击视频时,它必须使用他们拥有的标签过滤所有视频。它现在唯一能做的就是,当我想过滤它时,它会显示带有视频的正确标签,但不会显示正确的标签。然后它会从我首先发布的视频中提供标签。
点击后如何获得正确的标记值?当我想过滤标签?
<?php
$query = $connectie->prepare("SELECT v.VideoID,v.Titel,v.Link,v.Omschrijving,o.Bestandspath, o.Bestandsnaam,o.Onderwerp,t.Naam, DATE_FORMAT(`postDate`,\"%e-%m-%Y %H:%i\")as tijd FROM video v join opdracht o on v.OpdrachtID = o.OpdrachtID JOIN videotag vt on v.VideoID = vt.VideoID
JOIN tag t on vt.TagID = t.TagID order by `postDate` ");
$query->execute();
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$link = $row['Link'];
$newLink = str_replace("watch?v=", "embed/", $link);
$data = file_get_contents('https://www.youtube.com/oembed?format=json&url=' . $link);
// echo $newLink;
$json = json_decode($data);
$thumbnail = $json->thumbnail_url;
$title = $json->title;
$onderwerp = $row['Onderwerp'];
$omschrijving = $row['Omschrijving'];
$filePath = $row['Bestandspath'];
$bestandsnaam = $row['Bestandsnaam'];
$videoid = $row['VideoID'];
$tagName = $row['Naam'];
echo 'tagname',$tagName;
echo
'
<div class="scrollbar">
<a id="videoList" name="video" href="#" onclick="getLink(\'' . htmlentities($newLink) . '\',\'' . htmlentities($title) . '\',\'' . htmlentities($onderwerp) . '\',\''.htmlentities($tagName) . '\',\'' . htmlentities($omschrijving) . '\',\'' . htmlentities($bestandsnaam) . '\',\'' . htmlentities($filePath) . '\')">
<img src="' .htmlentities($thumbnail) . '" width="235"/>
<p id="titelText"><b>' . htmlentities($title) . '</b></p>
</a>
</div>
<script>
function getLink(link,titel,onderwerp,tagNaam,omschrijving,bestandsnaam,bestandspath){
document.getElementById("videoFrame").src = link;
document.getElementById("videoFrame").style.display = "block";
document.getElementById("overzicht").style.width = "275px";
document.getElementById("panelInfo").style.display = "block";
document.getElementById("titelVideo").innerHTML = "<b>Titel</b>:"+titel+"<br>";
document.getElementById("onderwerp").innerHTML = "<b>Onderwerp</b>:"+onderwerp+"<br>";
document.getElementById("tagnaam").innerHTML = "<b>Tag</b>:" + tagNaam + "<br>";
document.getElementById("omschrijving").innerHTML = "<b>Omschrijving</b>:"+omschrijving;
document.getElementById("bestand").download = bestandsnaam;
document.getElementById("bestand").href = bestandspath;
}
</script>';
}