<!DOCTYPE HTML>

<html>

   <body>

<?php

   include "pdo_connection.php";

   $sql1 = "SELECT ID, Name, Group_CHAR FROM _9a_arist ORDER BY Group_CHAR ASC, Name ASC";

   $stmt1 = $pdo->prepare($sql1);
   $stmt1->execute();

   while($row1 = $stmt1->fetch()) {

      echo "<div style='font-family: calibri; font-size: 14pt; padding: 10px; border-bottom: solid 1px gray; color: gray; border-top: solid 1px gray; color: gray; background-color: gainsboro;'>".$row1["Name"]."</div>";

      $sql2 = "SELECT Title FROM _9a_song WHERE Artist_ID = ? ORDER BY Title ASC";
      $stmt2 = $pdo->prepare($sql2);
      $values[] = $row1["ID"];
      $stmt2->execute($values);

      while($row2 = $stmt2->fetch()) {
         echo "<div style='font-family: calibri; font-size: 12pt; padding: 10px; border-bottom: solid 1px gainsboro; color: gray;'>".$row2["Title"]."</div>";
      }

   }

?>

   </body>

</html>