<?php
//tag listánál ez adja vissza a keresés eredményét
ini_set('include_path', '../_class/');
include('class_sql.php');
if ($_SERVER['HTTP_HOST'] == 'cegledcoach.hu') $sql = new sql('cegled_mysql','root','','badminton_coach');
else $sql = new sql('localhost','livingsp_coach','R186er012qw5','livingsp_badminton');

$filter1 = "";
if (!empty($_POST['uk_filter_name'])) {
    $filter1 = "AND uk_name LIKE '".$_POST['uk_filter_name']."%'";
}

$filter2 = "";
if (in_array($_POST['is_active'], array(0,1))) {
    $filter2 = "AND uk_is_active = " . $_POST['is_active'];
}

$kid_query = "SELECT uk_id, uk_name, uk_lease FROM user_kid WHERE uk_deleted = 0
". $filter1 . "
". $filter2 . "
ORDER BY uk_name ASC";

$kid_assoc_array = $sql->assoc_array($kid_query);


echo json_encode($kid_assoc_array);

?>
