ok

Mini Shell

Direktori : /home2/selectio/www/subamangala/admin/
Upload File :
Current File : /home2/selectio/www/subamangala/admin/search.php

<?php 
	ob_start();
	session_start();
	include"config/config.php";
?>
<?php
// Get search term
@$searchTerm = $_GET['term'];
if(isset($_GET['field']) && $_GET['field']=="bname")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE bname LIKE '%".$searchTerm."%' GROUP BY bname");
    $statement->execute();
    $bname = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_bname= $statement->rowCount();
	
	// Generate skills data array 
	$skillData = array();
	if($total_bname > 0){
		foreach($bname as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['bname'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}




if(isset($_GET['field']) && $_GET['field']=="dname")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE dname LIKE '%".$searchTerm."%' GROUP BY dname");
    $statement->execute();
    $dname = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_dname= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_dname > 0){
		foreach($dname as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['dname'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="job_place")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE job_place LIKE '%".$searchTerm."%' GROUP BY job_place");
    $statement->execute();
    $job_place = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_job_place= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_job_place > 0){
		foreach($job_place as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['job_place'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="job_company")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE job_company LIKE '%".$searchTerm."%' GROUP BY job_company");
    $statement->execute();
    $job_company = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_job_company= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_job_company > 0){
		foreach($job_company as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['job_company'];
			array_push($skillData, $data);
		}
	}
	echo json_encode($skillData);
	
}



if(isset($_GET['field']) && $_GET['field']=="father_job")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE father_job LIKE '%".$searchTerm."%' GROUP BY father_job");
    $statement->execute();
    $father_job = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_father_job= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_father_job > 0){
		foreach($father_job as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['father_job'];
			array_push($skillData, $data);
		}
	}
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="birth_place")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE birth_place LIKE '%".$searchTerm."%' GROUP BY birth_place");
    $statement->execute();
    $birth_place = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_birth_place = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_birth_place > 0){
		foreach($birth_place as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['birth_place'];
			array_push($skillData, $data);
		}
	}
	echo json_encode($skillData);
	
} 
if(isset($_GET['field']) && $_GET['field']=="family_idty")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE family_idty LIKE '%".$searchTerm."%' GROUP BY family_idty");
    $statement->execute();
    $family_idty = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_family_idty= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_family_idty > 0){
		foreach($family_idty as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['family_idty'];
			array_push($skillData, $data);
		}
	}
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="mother_place")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE father_place LIKE '%".$searchTerm."%' GROUP BY father_place");
    $statement->execute();
    $mother_place = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_mother_place= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_mother_place > 0){
		foreach($mother_place as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['father_place'];
			array_push($skillData, $data);
		}
	}
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="father_place")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE father_place LIKE '%".$searchTerm."%' GROUP BY father_place");
    $statement->execute();
    $father_place = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_father_place= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_father_place > 0){
		foreach($father_place as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['father_place'];
			array_push($skillData, $data);
		}
	}
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="mother_job")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE mother_job LIKE '%".$searchTerm."%' GROUP BY mother_job");
    $statement->execute();
    $mother_job = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_mother_job= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_mother_job > 0){
		foreach($mother_job as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['mother_job'];
			array_push($skillData, $data);
		}
	}
	echo json_encode($skillData);
	
}




if(isset($_GET['field']) && $_GET['field']=="caste")
{

	$statement = $pdo->prepare("SELECT * FROM caste WHERE name LIKE '%".$searchTerm."%'  GROUP BY name");
    $statement->execute();
    $caste = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_caste= $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_caste > 0){
		foreach($caste as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['name'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="rname")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE registeredby LIKE '%".$searchTerm."%'  GROUP BY registeredby");
    $statement->execute();
    $registeredby = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_registeredby = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_registeredby > 0){
		foreach($registeredby as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['registeredby'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="default")
{
	
	$statement = $pdo->prepare("SELECT * FROM caste GROUP BY name");
    $statement->execute();
    $caste = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_caste = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_caste > 0){
		foreach($caste as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['name'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="subcaste")
{
	
	$cid = $_GET['cid'];

	$statement = $pdo->prepare("SELECT * FROM subcaste WHERE casteid='$cid' AND name LIKE '%".$searchTerm."%' GROUP BY name");
    $statement->execute();
    $sub_caste = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_sub_caste = $statement->rowCount();
	
	$skillData = array();
	if($total_sub_caste > 0){
		foreach($sub_caste as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['name'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="brokername")
{
		$statement = $pdo->prepare("SELECT * FROM brokers WHERE brokername LIKE '%".$searchTerm."%' GROUP BY brokername");
        $statement->execute();
        $broker_name = $statement->fetchAll(PDO::FETCH_ASSOC);
    	$total_broker_name = $statement->rowCount();

	$skillData = array();
	if($total_broker_name > 0){
		foreach($broker_name as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['brokername'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}





if(isset($_GET['field']) && $_GET['field']=="father_name")
{
	    $statement = $pdo->prepare("SELECT * FROM profiles WHERE father_name LIKE '%".$searchTerm."%' GROUP BY father_name");
        $statement->execute();
        $father_name = $statement->fetchAll(PDO::FETCH_ASSOC);
    	$total_father_name = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_father_name > 0){
		foreach($father_name as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['father_name'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="father_dname")
{
	
    	$statement = $pdo->prepare("SELECT * FROM profiles WHERE father_dname LIKE '%".$searchTerm."%' GROUP BY father_dname");
        $statement->execute();
        $father_dname = $statement->fetchAll(PDO::FETCH_ASSOC);
    	$total_father_dname = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_father_dname > 0){
		foreach($father_dname as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['father_dname'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="mother_name")
{

	
	$statement = $pdo->prepare("SELECT * FROM profiles WHERE mother_name LIKE '%".$searchTerm."%' GROUP BY mother_name");
    $statement->execute();
    $mother_name = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_mother_name = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_mother_name > 0){
		foreach($mother_name as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['mother_name'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="mother_dname")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE mother_dname LIKE '%".$searchTerm."%' GROUP BY mother_dname");
    $statement->execute();
    $mother_dname = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_mother_dname = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_mother_dname > 0){
		foreach($mother_dname as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['mother_dname'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="ancestry")
{

	
	$statement = $pdo->prepare("SELECT * FROM profiles WHERE ancestry LIKE '%".$searchTerm."%' GROUP BY ancestry");
    $statement->execute();
    $ancestry = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_ancestry = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_ancestry > 0){
		foreach($ancestry as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['ancestry'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="edu")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE edu LIKE '%".$searchTerm."%' GROUP BY edu");
    $statement->execute();
    $edu = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_edu = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_edu > 0){
		foreach($edu as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['edu'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}


if(isset($_GET['field']) && $_GET['field']=="job")
{

	$statement = $pdo->prepare("SELECT * FROM profiles WHERE job LIKE '%".$searchTerm."%' GROUP BY job");
    $statement->execute();
    $job = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_job = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_job > 0){
		foreach($job as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['job'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="tyear")
{
	
	$statement = $pdo->prepare("SELECT * FROM profiles WHERE tyear LIKE '%".$searchTerm."%' GROUP BY tyear");
    $statement->execute();
    $tyear = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_tyear = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_tyear > 0){
		foreach($tyear as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['tyear'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

if(isset($_GET['field']) && $_GET['field']=="family_god")
{
	
	$statement = $pdo->prepare("SELECT * FROM profiles WHERE family_god LIKE '%".$searchTerm."%' GROUP BY family_god");
    $statement->execute();
    $family_god = $statement->fetchAll(PDO::FETCH_ASSOC);
	$total_family_god = $statement->rowCount();
	
	// Generate skills data array
	$skillData = array();
	if($total_family_god > 0){
		foreach($family_god as $row){
			$data['id'] = $row['id'];
			$data['value'] = $row['family_god'];
			array_push($skillData, $data);
		}
	}
	
	// Return results as json encoded array
	echo json_encode($skillData);
	
}

?>

Zerion Mini Shell 1.0