0

I have this php code that foreach row will add a HTML code if the selected season doesn't exist yet.

include 'php/dbhVid.php';

$sql = "SELECT * FROM video WHERE Serie = 'Steven Universe' ORDER BY Seasson ASC";
$result = mysqli_query($conn, $sql);

$done = array("");
while ($row = mysqli_fetch_assoc($result))
{
  $Test = $row['Seasson'];

  if (in_array($row['Seasson'], $done))
  {}
  else
  {
    $todo = "
    <div id='SeassContent'>
    <p id='SeassRow'>" . $row['Seasson']  . "</p>
    <div id='EpiRows'>"


    $todo2 = "
    </div>
    </div>
    ";
    echo "$todo";
    array_push($done, $row['Seasson']);
  }
}

on the middle of $todo and $todo2 i want to add <p> with the name of the episodes inside season so the html code look like this

<div id='SeassContent'>
<p id='SeassRow'>Seasson</p>
<div id='EpiRows'>
<p>SerieName</p>
<p>SerieName</p>
</div>
</div>

The problem is when i get the rows from sql it gets from different seasons and i need to compare if they are equal or not, and add if they are

pekira
  • 72
  • 11

0 Answers0