I have an error in displaying the results correctly
The errors, the problem that I am presenting
I get the one id_series
from the serial table and through the related id it shows me the data from the chapters table. so far it's perfect.
- 2017 series
- 2016 series
Now the problem is that it shows me the same videos (video 1, video 2) in both chapters (2017 series, 2016 series),
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, and in the 2016 series there are no chapters, it must not show me any index of the videos.
I think I should add the one id_chapters
from 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 shown because the detail of the video itself does not exist in the description_video column, thisNULL
Database structure
Boards
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 display 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 page premieres.php all the data from the table
series
when clicking on one of the series, it goes to the page detail.php where by means of its id I show the results related to the rest of the tables.
As you indicate, you must correct the relationship by adding
id_chapter
tovideo
:Boards
videos.
Then adjust the query according to that field:
For the problem of
+
Replace this section:For this: