<?php
  // File: response.php

  // Get POST gender value
  //$gender = $_POST["gender"];

  // Connect to the database
  // replace the parameters with your proper credentials
  //$connection = mysqli_connect("localhost", "username", "password", "database_name");

include_once'config.php';

  // Query to run
  $query = mysqli_query($link,
           "SELECT * FROM subject_name");

  // Create empty array to hold query results
  $someArray = [];

  // Loop through query and push results into $someArray;
  while ($row = mysqli_fetch_assoc($query)) {
    // array_push($someArray, [
    //   'subject'   => $row['st_subject'],
    //   'code' => $row['subject_code']
    // ]);

   $someArray[]= ['to'=>$row['st_subject'],'message'=>$row['subject_code']];


  }
 //print_r($someArray);  
 //$someArray[]= ['to'=>'12234','message'=> 'rttryy'];
 //$someArray[]=Array ( [0] => Array ([to] => 8801716550922 [message] => yyruyruru) [1] => Array ([to] => 8801534318453 [message] => vbnvmvjj) );
//   // Convert the Array to a JSON String and echo it
 $someJSON = json_encode($someArray);
  echo $someJSON;
?>