
<?php 


if ($cat == "" && $occu == "" && $package == "" && $rating == "" && $location == "" && $lang == "")
{
$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND status = 'Completed' AND plan_status = 'Active' AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESC") or die("Error2 : ". mysqli_error($con));
//$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND locality = '$locality'") or AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESCdie("Error2 : ". mysqli_error($con));

}

if ($cat !== "" && $occu == "" && $package == "" && $rating == "" && $location == "" &&  $lang == "")
{
$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND status = 'Completed' AND plan_status = 'Active' AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESC") or die("Error2 : ". mysqli_error($con));
//$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND locality = '$locality'") or die("Error2 : ". mysqli_error($con));

}
else if ($cat !== "" && $occu !== "" && $package == "" && $rating == "" && $location == "" && $lang == "")
{
$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND occupation = '$occu' AND status = 'Completed' AND plan_status = 'Active' AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESC" ) or die("Error2 : ". mysqli_error($con));
//$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND locality = '$locality'") or die("Error2 : ". mysqli_error($con));
}


else if ($cat !== "" && $occu !== "" && $package == "" && $rating == "" && $location == "" && $lang !== "")
{
$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND occupation = '$occu' AND language = '$lang' AND status = 'Completed' AND plan_status = 'Active' AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESC") or die("Error2 : ". mysqli_error($con));
//$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND locality = '$locality'") or die("Error2 : ". mysqli_error($con));
}


else if ($cat !== "" && $occu !== "" && $package !== "" && $rating == "" && $location == "")
{
$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND occupation = '$occu' AND plan = '$package' AND status = 'Completed' AND plan_status = 'Active' AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESC") or die("Error2 : ". mysqli_error($con));
//$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND locality = '$locality'") or die("Error2 : ". mysqli_error($con));
}


else if ($cat !== "" && $occu !== "" && $package !== "" && $rating !== "" && $location == "")
{
$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND occupation = '$occu' AND plan = '$package' AND rating = '$rating' AND status = 'Completed' AND plan_status = 'Active' AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESC") or die("Error2 : ". mysqli_error($con));
//$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND locality = '$locality'") or die("Error2 : ". mysqli_error($con));
}

else if ($cat !== "" && $occu !== "" && $package !== "" && $rating !== "" && $location !== "")
{
$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND occupation = '$occu' AND plan = '$package' AND rating = '$rating' AND locality = '$location' AND status = 'Completed' AND plan_status = 'Active' AND lng BETWEEN '$lngz' AND '$lngx' ORDER BY lng ASC, plan_level DESC") or die("Error2 : ". mysqli_error($con));
//$sql=$con->query("SELECT * FROM users WHERE user_type='Provider' AND category = '$cat' AND locality = '$locality'") or die("Error2 : ". mysqli_error($con));
}


?>