<?php
include 'connection.php';
$array = array();  
$query = "SELECT name, cat_id FROM compass where mockup='".$_GET['mockup']."'";  
$result = mysqli_query($mysqli , $query);  
while($row = mysqli_fetch_assoc($result))  
{  
    
    switch ($row['cat_id']) {
  case 1:
  $array[] = 'Name: '.$row['name'].', Category: Islamic';
    break;
  case 2:
   $array[] = 'Name: '.$row['name'].', Category: Simple';
    break;
  case 3:
    $array[] = 'Name: '.$row['name'].', Category: Dark';
    break;
  case 4:
      $array[] = 'Name: '.$row['name'].', Category: Caligraphy';
      break;
  case 5: 
      $array[] = 'Name: '.$row['name'].', Category: Flower';
    break;
  case 6: 
      $array[] = 'Name: '.$row['name'].', Category: Abstract';
    break;
  case 7: 
      $array[] = 'Name: '.$row['name'].', Category: Wooden';
    break;
}

    }  
    echo json_encode($array)

?>