I have a tv show I created a MySQL database for. I am trying to get my code to group and order correctly the seasons and episodes within their respective season.
Current Code
if (!($result = mysql_query("SELECT season_num, sub_season_num, esp_num, title, descrip FROM season ORDER BY season_num, sub_season_num", $link))) showerror();
$season_one = 1;
$season_two = 2;
echo "Season 1<br>";
while ($row = mysql_fetch_array($result))
{
if(season_num !== $season_one){
echo "Episode {$row["esp_num"]}<br>";
echo "Title {$row["title"]}<br>";
echo "Description {$row["descrip"]}<br>";
}}
echo "Season 2<br>";
while ($row = mysql_fetch_array($result))
{
if(season_num !== $season_two){
echo "Episode {$row["esp_num"]}<br>";
echo "Title {$row["title"]}<br>";
echo "Description {$row["descrip"]}<br>";
}}
?>
Example
Season 1
Eps 1
Eps 2
Eps 3
Season 2
Eps 1
Eps 2
Ect..
Any code help would be greatly appreciated.