I am currently trying to make a page of a TV series. Somehow the page only shows one row for seasons, which are 5 in my database.
$sql = "SELECT * FROM `shows` WHERE url='".dburl($_GET["url"])."'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
// General info about the TV show here
$sql = "SELECT * FROM seasons WHERE `show`='".$row["id"]."' ORDER BY number ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($seasons = $result->fetch_assoc()) {
// The seasons
$sql= "SELECT * FROM episodes WHERE `show`='".$row["id"]."' AND `season`='".$seasons["number"]."' ORDER BY number DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($episodes = $result->fetch_assoc()) {
// The episodes, sorted by season
}
}
}
}
}
}
Is there any change I overlooked something? The episodes part works just perfectly fine, it shows all the episodes that are in a season.