<commit_before><?php
require_once 'api_config.php';

$org_code = (int) mysql_real_escape_string(trim($_REQUEST['org_code']));
$staff_id = (int) mysql_real_escape_string(trim($_REQUEST['staff_id']));
$div_code = (int) mysql_real_escape_string(trim($_REQUEST['div_code']));
$dis_code = (int) mysql_real_escape_string(trim($_REQUEST['dis_code']));
$upa_code = (int) mysql_real_escape_string(trim($_REQUEST['upa_code']));
$agency_code = (int) mysql_real_escape_string(trim($_REQUEST['agency_code']));
$org_type_code = (int) mysql_real_escape_string(trim($_REQUEST['org_type_code']));
$area_name = mysql_real_escape_string(trim($_REQUEST['area_name']));
$area_level = mysql_real_escape_string(trim($_REQUEST['area_level']));


$format = mysql_real_escape_string(trim($_REQUEST['format']));

function getOrganizationBasicInfo($org_code) {
    $sql = "SELECT * FROM organization WHERE  org_code =$org_code LIMIT 1";
    $result = mysql_query($sql) or die(mysql_error() . "<br /><br />Code:<b>getOrganizationBasicInfo:1</b><br /><br /><b>Query:</b><br />___<br />$sql<br />");

    $data = mysql_fetch_assoc($result);

    return $data;
}

function getStaffBasicInfo($staff_id, $format) {
    $sql = "SELECT
                *
            FROM
                old_tbl_staff_organization
            WHERE
                old_tbl_staff_organization.staff_id = $staff_id
            LIMIT 1";
    $result = mysql_query($sql) or die(mysql_error() . "<br /><br />Code:<b>getStaffBasicInfo:1</b><br /><br /><b>Query:</b><br />___<br />$sql<br />");

    $data = mysql_fetch_assoc($result);
    return $data;
}

function getListOfOrganizations($div_code, $dis_code, $upa_code, $agency_code, $org_type_code) {
    $query_string = "";

    if ($upa_code > 0) {
        $query_string .= " AND organization.upazila_thana_code = $upa_code";
    }
    if ($dis_code > 0) {
        $query_string .= " AND organization.district_code = $dis_code";
    }
    if ($div_code > 0) {
        $query_string .= " AND organization.division_code = $div_code";
    }
    if ($org_type_code > 0) {
        $query_string .= " AND organization.org_type_code = $org_type_code";
    }

    $query_string .= " ORDER BY org_name";

    $sql = "SELECT
                organization.org_code,
                organization.org_name,
                organization.division_code,
                organization.district_code,
                organization.upazila_thana_code,
                organization.agency_code,
                organization.org_type_code
            FROM
                organization
            WHERE
                organization.agency_code = $agency_code ";
    $sql .= $query_string;<commit_msg>minor fix<commit_after><?php
require_once 'api_config.php';

$org_code = (int) mysql_real_escape_string(trim($_REQUEST['org_code']));
$staff_id = (int) mysql_real_escape_string(trim($_REQUEST['staff_id']));
$div_code = (int) mysql_real_escape_string(trim($_REQUEST['div_code']));
$dis_code = (int) mysql_real_escape_string(trim($_REQUEST['dis_code']));
$upa_code = (int) mysql_real_escape_string(trim($_REQUEST['upa_code']));
$agency_code = (int) mysql_real_escape_string(trim($_REQUEST['agency_code']));
$org_type_code = (int) mysql_real_escape_string(trim($_REQUEST['org_type_code']));
$area_name = mysql_real_escape_string(trim($_REQUEST['area_name']));
$area_level = mysql_real_escape_string(trim($_REQUEST['area_level']));


$format = mysql_real_escape_string(trim($_REQUEST['format']));

function getOrganizationBasicInfo($org_code) {
    $sql = "SELECT * FROM organization WHERE  org_code ='$org_code' LIMIT 1";
    $result = mysql_query($sql) or die(mysql_error() . "<br /><br />Code:<b>getOrganizationBasicInfo:1</b><br /><br /><b>Query:</b><br />___<br />$sql<br />");

    $data = mysql_fetch_assoc($result);

    return $data;
}

function getStaffBasicInfo($staff_id, $format) {
    $sql = "SELECT
                *
            FROM
                old_tbl_staff_organization
            WHERE
                old_tbl_staff_organization.staff_id = '$staff_id'
            LIMIT 1";
    $result = mysql_query($sql) or die(mysql_error() . "<br /><br />Code:<b>getStaffBasicInfo:1</b><br /><br /><b>Query:</b><br />___<br />$sql<br />");

    $data = mysql_fetch_assoc($result);
    return $data;
}

function getListOfOrganizations($div_code, $dis_code, $upa_code, $agency_code, $org_type_code) {
    $query_string = "";

    if ($upa_code > 0) {
        $query_string .= " AND organization.upazila_thana_code = '$upa_code'";
    }
    if ($dis_code > 0) {
        $query_string .= " AND organization.district_code = '$dis_code'";
    }
    if ($div_code > 0) {
        $query_string .= " AND organization.division_code = '$div_code'";
    }
    if ($org_type_code > 0) {
        $query_string .= " AND organization.org_type_code = '$org_type_code'";
    }

    $query_string .= " ORDER BY org_name";

    $sql = "SELECT
                organization.org_code,
                organization.org_name,
                organization.division_code,
                organization.district_code,
                organization.upazila_thana_code,
                organization.agency_code,
                organization.org_type_code
            FROM
                organization
            WHERE
                organization.agency_code = '$agency_code' ";
    $sql .= $query_string;
{'fraction_non_alphanumeric': 0.14947683109118087, 'fraction_numerical': 0.0029895366218236174, 'mean_word_length': 3.3520325203252033, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '25294', 'n_tokens_mistral': 1802, 'n_tokens_neox': 1713, 'n_words': 276}