You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND is_active = 1 AND deleted_at IS NULL OR' at line 142

Code:get_org_list:1

Query:
___
SELECT dghshrml4_facilities.id, dghshrml4_facilities.`name`, dghshrml4_facilities.`code`, dghshrml4_facilities.division_id, dghshrml4_facilities.division_code, dghshrml4_facilities.division_name, dghshrml4_facilities.district_id, dghshrml4_facilities.district_code, dghshrml4_facilities.district_name, dghshrml4_facilities.upazila_id, dghshrml4_facilities.upazila_code, dghshrml4_facilities.upazila_name, dghshrml4_facilities.paurasava_id, dghshrml4_facilities.paurasava_code, dghshrml4_facilities.paurasava_name, dghshrml4_facilities.union_id, dghshrml4_facilities.union_code, dghshrml4_facilities.union_name, dghshrml4_facilities.ward_id, dghshrml4_facilities.ward_code, dghshrml4_facilities.ward_name, dghshrml4_facilities.village_code, dghshrml4_facilities.house_number, dghshrml4_facilities.latitude, dghshrml4_facilities.longitude, dghshrml4_facilities.photo, dghshrml4_facilities.mailing_address, dghshrml4_facilities.landphone1, dghshrml4_facilities.landphone2, dghshrml4_facilities.landphone3, dghshrml4_facilities.mobile1, dghshrml4_facilities.mobile2, dghshrml4_facilities.mobile3, dghshrml4_facilities.email1, dghshrml4_facilities.email2, dghshrml4_facilities.email3, dghshrml4_facilities.fax1, dghshrml4_facilities.fax2, dghshrml4_facilities.fax3, dghshrml4_facilities.websiteurl, dghshrml4_facilities.facebookurl, dghshrml4_facilities.googleplusurl, dghshrml4_facilities.twitterurl, dghshrml4_facilities.youtubeurl, dghshrml4_facilities.facilitytype_id, dghshrml4_facilities.facilitytype_code, dghshrml4_facilities.facilitytype_name, dghshrml4_facilities.facilityagency_id, dghshrml4_facilities.facilityagency_code, dghshrml4_facilities.facilityagency_name, dghshrml4_facilities.facilityfunction_id, dghshrml4_facilities.facilityfunction_code, dghshrml4_facilities.facilityfunction_name, dghshrml4_facilities.facilitylevel_id, dghshrml4_facilities.facilitylevel_code, dghshrml4_facilities.facilitylevel_name, dghshrml4_facilities.facilityhealthcarelevel_id, dghshrml4_facilities.facilityhealthcarelevel_code, dghshrml4_facilities.facilityhealthcarelevel_name, dghshrml4_facilities.facilitylocationtype_id, dghshrml4_facilities.facilitylocationtype_code, dghshrml4_facilities.facilitylocationtype_name, dghshrml4_facilities.facilityownership_id, dghshrml4_facilities.facilityownership_code, dghshrml4_facilities.facilityownership_name, dghshrml4_facilities.main_electricitysourceoption_id, dghshrml4_facilities.main_electricitysourceoption_code, dghshrml4_facilities.main_electricitysourceoption_name, dghshrml4_facilities.alt_electricitysourceoption_id, dghshrml4_facilities.alt_electricitysourceoption_code, dghshrml4_facilities.alt_electricitysourceoption_name, dghshrml4_facilities.main_watersourceoption_id, dghshrml4_facilities.main_watersourceoption_code, dghshrml4_facilities.main_watersourceoption_name, dghshrml4_facilities.alt_watersourceoption_id, dghshrml4_facilities.alt_watersourceoption_code, dghshrml4_facilities.alt_watersourceoption_name, dghshrml4_facilities.toiletoption_id, dghshrml4_facilities.toiletoption_code, dghshrml4_facilities.toiletoption_name, dghshrml4_facilities.toiletadequacytype_id, dghshrml4_facilities.toiletadequacytype_code, dghshrml4_facilities.toiletadequacytype_name, dghshrml4_facilities.fuelsourceoption_id, dghshrml4_facilities.fuelsourceoption_code, dghshrml4_facilities.fuelsourceoption_name, dghshrml4_facilities.laundrysystemoption_id, dghshrml4_facilities.laundrysystemoption_code, dghshrml4_facilities.laundrysystemoption_name, dghshrml4_facilities.autoclavesystemoption_id, dghshrml4_facilities.autoclavesystemoption_code, dghshrml4_facilities.autoclavesystemoption_name, dghshrml4_facilities.wastedisposeoption_id, dghshrml4_facilities.wastedisposeoption_code, dghshrml4_facilities.wastedisposeoption_name, dghshrml4_facilities.permission_approval_license_number, dghshrml4_facilities.permission_approval_license_next_renewal_date, dghshrml4_facilities.permission_approval_license_conditions, dghshrml4_facilities.permission_approval_license_info_code, dghshrml4_facilities.permission_approval_license_info_date, dghshrml4_facilities.permission_approval_license_type, dghshrml4_facilities.permission_approval_license_aithority, dghshrml4_facilities.land_info_code, dghshrml4_facilities.land_size_decimal, dghshrml4_facilities.land_mouza_name, dghshrml4_facilities.land_mouza_geo_code, dghshrml4_facilities.land_jl_number, dghshrml4_facilities.land_functional_code, dghshrml4_facilities.land_rs_dag_number, dghshrml4_facilities.land_ss_dag_number, dghshrml4_facilities.land_kharian_number, dghshrml4_facilities.land_other_info, dghshrml4_facilities.land_mutation_number, dghshrml4_facilities.additional_chcp_name, dghshrml4_facilities.additional_chcp_contact, dghshrml4_facilities.additional_community_group_info, dghshrml4_facilities.additional_chairnam_name, dghshrml4_facilities.additional_chairman_contact, dghshrml4_facilities.additional_chairman_community_support_info, dghshrml4_facilities.additional_csg_1_name, dghshrml4_facilities.additional_csg_1_contact, dghshrml4_facilities.additional_csg_2_name, dghshrml4_facilities.additional_csg_2_contact, dghshrml4_facilities.sanctioned_office_equipment, dghshrml4_facilities.sanctioned_vehicles, dghshrml4_facilities.approved_bed_number, dghshrml4_facilities.revenue_bed_number, dghshrml4_facilities.development_bed_number, dghshrml4_facilities.physical_structure_value, dghshrml4_facilities.other_miscellaneous_issues, dghshrml4_facilities.financial_revenue_code, dghshrml4_facilities.establishmentyear, dghshrml4_facilities.updated_by, dghshrml4_facilities.created_at, dghshrml4_facilities.updated_at, dghshrml4_facilities.is_active FROM `dghshrml4_facilities` AND is_active = 1 AND deleted_at IS NULL ORDER BY `name`