<?php

   include "pdo_connection.php";

   if($_REQUEST["lc"] != "") {
      $sql = "SELECT ID, Name FROM _9a_arist WHERE Group_CHAR = '".$_REQUEST["lc"]."' ORDER BY Name";
      $values[] = $_REQUEST["lc"];
      $stmt = $pdo->prepare($sql);
      $stmt->execute($values);
   } else {
      $sql = "SELECT ID, Name FROM _9a_arist ORDER BY Name";
      $stmt = $pdo->prepare($sql);
      $stmt->execute();
   }
   
   $output = "OK";
      
   if($stmt->rowCount() == 0) echo "ERROR#No artists.";
   else {
      while($row = $stmt->fetch()) {
         $output = $output."#".$row["ID"]."|".$row["Name"];
      }
      echo $output;
   }

?>