function searchPerson() { $where = " 1=1"; $whereParam = array(); if (isset($_REQUEST["query"]) && $_REQUEST["query"] != "") { $where .= " AND (PFName LIKE :qry or PLName LIKE :qry or concat(PFName,' ',PLName) like :qry\n\t\t\t\t or concat(PLName,' ',PFName) like :qry \n\t\t\t\t OR p.PersonID = :qry2\n\t\t\t\t OR o.ptitle like :qry\n\t\t\t\t\t\t\t\t\t\t OR s.staff_id = :qry2\n\t\t\t\t)"; $whereParam = array(":qry" => "%" . $_REQUEST["query"] . "%", ":qry2" => $_REQUEST["query"]); } $include_new_persons = isset($_REQUEST["newPersons"]) ? true : false; $show_All_history = isset($_REQUEST["show_All_history"]) ? true : false; if (isset($_REQUEST['ouid'])) { $whereParam[":ouid"] = $_REQUEST['ouid']; $whereParam[":ouid2"] = "%," . $_REQUEST['ouid'] . ",%"; $whereParam[":ouid3"] = "%" . $_REQUEST['ouid'] . ",%"; $whereParam[":ouid4"] = "%," . $_REQUEST['ouid'] . "%"; $where .= " AND ( o.parent_path like :ouid2 OR\n o.parent_path like :ouid3 OR\n o.parent_path like :ouid4 OR\n o.ouid=:ouid OR\n o.parent_ouid = :ouid\n ) "; } $temp = manage_person::SelectPerson($where, $whereParam, $include_new_persons, $show_All_history); $no = count($temp); $temp = array_slice($temp, $_GET["start"], $_GET["limit"]); echo dataReader::getJsonData($temp, $no, $_GET["callback"]); die; }