I'm trying to pass a string argument param in the form
number,number,number.... for example 1,3,5,4,8,2
and split it up into an array of numbers and then carry out the checkuserbets function from the Check_Bets.php file on each of the numbers and return the results as an array. However, when I run this in a REST client, I get
{"error":true,"error_msg":"the response is null!"}
as if I didn't pass the proper parameter or didn't use the POST method. This is what I am passing :

Check_Bets_Handler.php
<?php
if (isset($_POST['param'])) {
// get tag
$param= $_POST['param'];
$id = explode(",",$param);
$arrlength = count($id);
// include db handler
require_once 'include/Check_Bets.php';
$db = new Check_Bets();
$response["bet"] = array();
for($x = 0; $x < $arrlength; $x++) {
$result= $db->checkuserbets($id[$x]);
array_push($response["bet"], $result);
}
echo json_encode($response);
}
else {
$response["error"] = TRUE;
$response["error_msg"] = "the response is null!";
echo json_encode($response);
}
?>
Check_Bets.php
<?php
class Check_Bets {
function __construct() {
require_once 'DB_Connect.php';
$this->db = new DB_Connect();
$this->db->connect();
}
function __destruct() {
}
public function checkuserbets($id) {
$conn=mysqli_connect("****", "******", "****","****");
$result = mysqli_query($conn,"SELECT Result FROM gamelist WHERE gid = '$id'");
$no_of_rows = mysqli_num_rows($result);
if ($no_of_rows > 0) {
return mysqli_fetch_array($result,MYSQLI_ASSOC);
}
}
}
?>

print "<PRE><FONT COLOR=ORANGE>"; print_r($_POST); print "</FONT></PRE>"; exit;