How do i select the next row in php from mysql table, i have 4 columns ID, video_title, video_desc, video_embed
so i have more than 10000 rows in the table with youtube embed videos and i want to scroll though them with next and previous buttons but thats not the limit i will add more in the future. Am little confuzed on how do i change the videos from page to page with new URL's here is an example what i have right now.
index.php
<?php
$sql = "SELECT ID, video_title, video_desc, video_embed FROM videos";
$result = $conn->query($sql);
if (!$result) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
} elseif ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$ID = $row["ID"];
$title = $row["video_title"];
$desc = $row["video_desc"];
$embed = $row["video_embed"];
}
}
?>
<body>
<div class="row">
<div class="col-sm-8 col-md-offset-2 text-center video">
<h2><?= $title ?></h2>
<a href="#"><span class="glyphicon glyphicon-menu-left" aria-hidden="true">PREVIOUS VIDEO</span></a>
<div class="embed-responsive embed-responsive-16by9">
<?= $embed ?>
</div>
<a href="#"><span class="glyphicon glyphicon-menu-right" aria-hidden="true">NEXT VIDEO</span></a>
<h3><?= $desc ?></h3>
</div>
</div>
</body>
BTW The URL should be the $title
of the video
So for example like this
www.example.com/Mercedes-Benz
you click NEXT VIDEO button, opens new page with new url
www.example.com/BMW-M4