I have an error in displaying the results correctly
Errors, the problem I'm presenting
I get the id_series
of the serial table and using the id related, it shows me the data from the chapters table until it is perfect.
- Series 2017
- 2016 series
Now the problem is that it shows me the same videos (video 1, video 2) in both chapters (series 2017, series 2016),
To solve it I must pass a new condition to the query not to show the same videos in both chapters, that is video 1, video 2, must belong to the 2017 series, strong> and in the 2016 series there are no chapters you should not show me any index of the videos.
I think I should add the id_chapters
of the chapters table to the videos table
id_videos title_video description_video multimedia id_series id_chapters
The other error is that in chapter 2 it shows me the + button and this button should not be displayed because they do not exist in the description_video the detail of the same video, this NULL
Structure of the database
Tables
series.
id_series title detail author
1 New serie 1 Serie 2017 anónimo
2 New aventure 2 Serie 2016 anónimo
chapters.
id_chapters chapters id_series
1 Serie 2017 1
2 serie 2016 1
videos.
id_videos title_video description_video multimedia id_series
1 video 1 En este capitulo... video1.mp4 1
2 video 2 NULL video2.mp4 1
I get the id
of the series to show the data related to the series.
if (isset($_GET['id'])){
$id = $_GET['id'];
$sql = "SELECT * FROM series WHERE url='".$id."'";
$result = mysqli_query($con, $sql);
if(mysqli_num_rows($result) > 0){
while ($row = mysqli_fetch_array($result)) {
$id = $row['id_series'];
}
}
}
Example:
I show on the premieres.php page all the data in the
series
table when clicking on one of the series, go to the detalle.php page where through its id I show the results related to the rest of the tables.