问题
This is my code for a website that displays videos from a MySQL database. 'videoRef' is the YouTube embed code that is stored in a video table.
$result=mysqli_query($link, "SELECT * FROM videos")
or die( mysqli_error($link) );
echo "<table border=0><tr><th>Title</th><th>Creator</th><th>Upload Date</th><th >Difficulty</th><th>Video</th></tr>";
while ($data = mysqli_fetch_array($result) ){
echo "<tr>";
echo "<td>" . $data['Title'] . "</td>";
echo "<td>" . $data['Creator'] . "</td>";
echo "<td>" . $data['Upload Date'] . "</td>";
echo "<td>" . $data['Difficulty'] . "</td>";
echo "<td>" . '<iframe width="350" height="200" src="https://www.youtube.com/embed/'.($data['videoRef']).'" allowfullscreen>
</iframe>' . "</td>";
echo "</tr>";
}
I would like to make it so that when a row is clicked, it will redirect to another page and start playing the respective video but the video dimensions are larger. Any help would be greatly appreciated :).
回答1:
The possible solutions:
- Include link with embed wideo with large dimensions:
<a href="https://www.youtube.com/embed/".$data['videoRef']><iframe>...</iframe></a>
- Include usual link to video:
<a href="https://www.youtube.com/watch?v=".$data['videoRef']><iframe>...</iframe></a>
来源:https://stackoverflow.com/questions/65794230/after-clicking-on-table-tr-how-can-i-display-this-data-on-another-page