I am writing rest apis in php, but the errors are thrown when there are some null values are inserted in the api.It shows the sql query into the response page, how do I stop it from being displayed, what is the best exception handling in this case.I am bit new to php, so any help is appreciated. Below is the sample code I write to query.
$limit = " LIMIT ".$post_data['offset'].",".$post_data['limit'];
$sql = "SELECT record_id from ";
$shareResult= $this->db->query($sql)->result_array();
if(empty($shareResult[0]['record_id']) || $shareResult[0]['record_id'] != 0){
$query="SELECT *";
$result= $this->db->query($query);
if($result->num_rows()>0){
$res1=$this->db->query($qry)->result_array();
$res[0]=$res1[0];
$res[1]=$result->result_array();
return $res;
}
}else if($shareResult[0]['record_id'] === 0){
return false;
}