So just dump the arrays with the data (it's a simple way to check the values&types):
B4X:$a = array(1, 2, array("a", "b", "c")); var_dump($a);
just modify the code and call the script via browser (or see the job's response).
The output is:
B4X:array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } }
It just shows what type the value is. So if you compare a string (even if it looks like an integer) with a real integer may cause your problem. Take a look at the database, too. Are the culumns integers? Sure?
I used var dump and got the response. BUt I want to clearify that i have no problem with my php cpde:
B4X:
Case "24": //yakınklarıal
$usn = clean($_GET["girdi1"]);
$psw = md5(clean($_GET["girdi2"]));
$base = clean($_GET["girdi3"]);
$p1 = clean($_GET["girdi4"]);
$p2 = clean($_GET["girdi5"]);
$value1 = 500;
$value2 = 1500;
$q = "SELECT ident,latitude_deg,longitude_deg,iso_country,name FROM airports3";
// $q = "SELECT * FROM useraircrafts1 where username='".$usn."' order by date DESC";
$r = mysql_query($q);
$all = array();
while(($row = mysql_fetch_assoc($r))) {
$lat2=$row['latitude_deg'];
$lon2=$row['longitude_deg'];
$ident=$row['ident'];
$ulke=$row['iso_country'];
$name=$row['name'];
// $all[] = distance('29','41',$lat2,$lon2,'N');
$arr[] = array('uzaklik' => distance('41','26',$lat2,$lon2,'N'), 'ident' => $ident, 'ulke' => $ulke, 'name' => $name);
}
$uzaklik = array();
foreach ($arr as $key => $row2)
{
$uzaklik[$key] = $row2['uzaklik'];
}
array_multisort($uzaklik, SORT_ASC, $arr);
$new = array_filter($arr, function ($var) {
return ($var['uzaklik'] > '500' and $var['uzaklik'] < '1500');
});
print json_encode(array_slice($new, 0, 10000));
This code works fine. Only problem i am having is : IF i change the line
return ($var['uzaklik'] > '500' and $var['uzaklik'] < '1500');
to
return ($var['uzaklik'] > $value1 and $var['uzaklik'] < $value2);
the result i get is wrong because $value1 and $value2 is taken as 0 not 500 and 1500 as i decalred at the code.
I also dumped as you requested but i think there is no problem at db or in my response as i can get what i want when I use
return ($var['uzaklik'] > '500' and $var['uzaklik'] < '1500');
I just cant manage to change 500 and 1500 to a declared value like $value1 $value2
..
The result of dump by the way:
B4X:
[335]=>
array(4) {
["uzaklik"]=>
float(512.72256311684)
["ident"]=>
string(4) "EGGW"
["ulke"]=>
string(2) "GB"
["name"]=>
string(20) "London Luton Airport"
}
[336]=>
array(4) {
["uzaklik"]=>
float(513.223953618)
["ident"]=>
string(4) "EGPB"
["ulke"]=>
string(2) "GB"
["name"]=>
string(16) "Sumburgh Airport"
}
[337]=>
array(4) {
["uzaklik"]=>
float(514.55130928659)
["ident"]=>
string(4) "LFOK"
["ulke"]=>
string(2) "FR"
["name"]=>
string(21) "ChalonsVatry Air Base"
}
and goes on like this ..