I am continuously having this internal server error to a very simple php code working with JSON. The values I am logging from the code is absolutely correct, yet when in action I am getting an internal server error 500 from this particular code. I had a similar code working previously. What am I doing wrong? or how should I proceed with debugging the error?
<?php
$var2 = $_POST['phn'];
$phone_received = json_decode($var2);
$adb = PearDatabase::getInstance();
$query1 = "SELECT addressid FROM address WHERE mobile = ?";
$leadID = $adb->pquery($query1, array($phone_received));
$row= $adb->num_rows($leadID);
if ($row != 0) {
$result = 'This number has already been used in the system.';
echo json_encode($result);
}else{
$result = 'Good to go!';
echo json_encode($result);
}
?>