$respArr=array('status'=>0,'code'=>'918','message'=>'Something Went Wrong..Try Again');
if(empty($data)){
return$respArr;
}
$phNumbers='';
foreach($data['contacts']AS$key=>$number){
$eCond=($key!=count($data['contacts'])-1)?' OR ':'';
if(strlen($number)>10){
$phNumbers.=" phone LIKE '%".substr($number,strlen($number)-10)."' ".$eCond;
}else{
$phNumbers.=" phone LIKE '%".$number."' ".$eCond;
}
}
$result=$this->db->query("SELECT name,phone,profile_image FROM customer WHERE (".$phNumbers.") AND customer_id NOT IN (SELECT from_user FROM chats WHERE (from_user=$user_id AND type='2') OR (to_user =$user_id AND type='2')) AND customer_id NOT IN (SELECT to_user FROM chats WHERE (from_user=$user_id AND type='2') OR (to_user =$user_id AND type='2'))");
$result=$this->db->query("SELECT from_user,to_user,type FROM chats WHERE (from_user=$user_id OR to_user=$user_id) AND type IN('0','1')")->result_array();