Jump to content

create and add to an array, then sort by a key.


JKG

Recommended Posts

Hello,

 

Im struggling with this, probably because of my lack of fundamental knowledge of arrays.

 

What i want to do is:

make an array with two keys. 'id' and 'distance'.

 

I want to sort the results by distance, displaying the id's...

 

im looking at ksort() as the solution, however i don't think im implementing it properly as i dont think i have set the array up properly!!

 

what i have is not good...

 

<?php
while ($row = mysql_fetch_array($result)) {
				//get the photographers postcode and split it into 2 pieces
				$p_postcode = explode(' ',$row['address_post_code']);
				//get the photographers postcode and split it into 2 pieces
				$u_postcode_a = explode(' ',$u_postcode);
				//run the two postcodes throught the function to determin the deistance
				$final_distance = return_distance($u_postcode_a[0], $p_postcode[0]);
				//start the variable so we can add to it later on
				$photographers_inrange = "";
				//declare this variable to help with the comma spacing too EDIT LOOK TO LINE 46
				//$i2 = 1;
				$photographers_inrange = array();
				//if the distance is smaller or equal to the distance the photographer covers
				if($final_distance <= $row['cover_distance']){
					//get their id
					$photographers_inrange['id'] = $row['ID'].',';
					$photographers_inrange['distance'] = ''.$final_distance;
					//echo $photographers_inrange;
					//EDIT: this method does not work when just one result is returned. now i use substr -1.
					//if this isnt the last result
					//if($i++ <= $i2++){
					//then add a comma for the sql statement
					//$photographers_inrange .= ',';
					//}
				}

			ksort($photographers_inrange);
foreach ($photographers_inrange as $key => $val) {
    echo "togs[" . $key . "] = " . $val . "<br/>";
}
?>

 

with $photographers_inrange being where it is, i am getting alot of empty arrays. not what i want.

i just need to know how to add to the original array, and how to then sort it.

 

thanks for your ongoing help!!

Link to comment
Share on other sites

hmm, my question must have really sucked!

 

i have got to a point where i have something useful.

 

<?php 

$input = array ("11" => "233", "12" =>"2", "14" =>"999", "345" =>"1", "8765" =>"7654321456","1" =>"2");
asort($input);
while (list ($key, $val) = each ($input)) {
echo "$key -> $val <br>";
}

?>

 

gives me this

 

345 -> 1 
12 -> 2 
1 -> 2 
11 -> 233 
14 -> 999 
8765 -> 7654321456 

 

which is perfect.

 

now, please can you help me to construct this array in php using a loop, and not type it out like i have. with the format being:

 

array (id => distance, id => distance)

 

thank you!!

Link to comment
Share on other sites

Only adding the id and distance to the array doesn't make sense. I have to imagine that you want to output more data than just the ID and the distance (name, address, url, etc.???). By creating an array with just the distance and ID it will be difficult to match the data up with the records.  You should create a multidimensional array with all of the photographer data you need and ADD the distance. Then you can use usort() along with a custom function to sort the array in any manner you want. In the solution below it sorts first by distance then by "name". So, if two records have the same distance they will be sorted by name. I just guessed on the field name, but you can change it to whatever you want and/or modify the sorting function however you need.

 

$photographers_inrange = array();
while ($row = mysql_fetch_array($result))
{
    //get the photographers postcode and split it into 2 pieces
    $p_postcode = strstr($row['address_post_code'], ' ', TRUE);
    //get the photographers postcode and split it into 2 pieces
    $u_postcode_a = strstr($u_postcode, ' ', TRUE);
    //run the two postcodes throught the function to determin the deistance
    $distance = return_distance($u_postcode_a, $p_postcode);

    //if the distance is <= to the distance the photographer covers
    if($distance <= $row['cover_distance'])
    {
        //Add entire record to array
        $photographers_inrange[$row['ID']] = $row;
        //Add distance to array
        $photographers_inrange[$row['ID']]['distance'] = $distance;
    }
}

//Custom function for sorting by distance, then by "name"?
function sortPhotographers($a, $b)
{
    if ($a['distance'] != $b['distance'])
    {
        return ($a['distance'] < $b['distance']) ? -1 : 1;
    }
    if($a['name'] != $b['name'])
    {
        return ($a['distance'] < $b['distance']) ? -1 : 1;
    }
    return 0;
    
}

//Sort the records
usort($photographers_inrange, 'sortPhotographers');

foreach ($photographers_inrange as $id => $record)
{
    echo "{$record['name']} ({$record['ID']}): {$record['distance']}KM<br>\n";
}

Link to comment
Share on other sites

thank you so much for putting all that time and effort into a really good solution.

 

the reason i am only wanting ID's and distance is i generate a SQL command using WHERE IN (ids).

 

I have this:

<?php
				if($final_distance <= $row['cover_distance']){
					$togs[$row['ID']] = $final_distance;
				}

				//asort($togs);
				while (list ($key, $val) = each ($togs)) {
					echo "$key -> $val <br>";
				} ?>

which gives me my two peices of data like this:

 

10 -> 103.56 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
36 -> 187.57 
39 -> 105.19 
40 -> 87.98 
41 -> 56.93 
42 -> 95 
43 -> 54.69 
44 -> 55.92 
46 -> 50.53 
58 -> 127.33 
59 -> 226.06 
61 -> 135.56 
63 -> 290.16 
66 -> 119.92 
70 -> 41.29 
73 -> 162.77 
75 -> 61.47 
76 -> 114.73 
78 -> 154.7 
80 -> 117.83 
81 -> 100.29 
83 -> 106.85 
84 -> 170.9 
85 -> 43.15 
87 -> 83.67 
88 -> 197.34 
89 -> 85.39 
91 -> 139.44 
92 -> 54.87 
93 -> 181.8 
95 -> 175.22 
97 -> 198.68 
99 -> 56.93 
102 -> 56.93 
104 -> 91.65 
110 -> 88.39 
113 -> 87.95 
116 -> 172.37 
117 -> 117.99 
118 -> 84.02 
120 -> 194.8 
127 -> 184.31 
129 -> 166.8 
135 -> 88.08 
136 -> 92.82

 

however, when running it through asort() it seems to run through the arrays one by one, each array being added on and evaluated. like this:

 

10 -> 103.56 
10 -> 103.56 
28 -> 196.4 
10 -> 103.56 
28 -> 196.4 
10 -> 103.56 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
10 -> 103.56 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
10 -> 103.56 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
10 -> 103.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
40 -> 87.98 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
41 -> 56.93 
40 -> 87.98 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
43 -> 54.69 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
58 -> 127.33 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
58 -> 127.33 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
58 -> 127.33 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
73 -> 162.77 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
73 -> 162.77 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
76 -> 114.73 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
73 -> 162.77 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
76 -> 114.73 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
10 -> 103.56 
39 -> 105.19 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
99 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
41 -> 56.93 
99 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
99 -> 56.93 
41 -> 56.93 
102 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
102 -> 56.93 
99 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
99 -> 56.93 
102 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
102 -> 56.93 
99 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
99 -> 56.93 
41 -> 56.93 
102 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
102 -> 56.93 
99 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
99 -> 56.93 
41 -> 56.93 
102 -> 56.93 
75 -> 61.47 
87 -> 83.67 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
102 -> 56.93 
99 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
99 -> 56.93 
41 -> 56.93 
102 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
102 -> 56.93 
99 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
127 -> 184.31 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
99 -> 56.93 
41 -> 56.93 
102 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
129 -> 166.8 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
127 -> 184.31 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
129 -> 166.8 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
127 -> 184.31 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
99 -> 56.93 
102 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
135 -> 88.08 
110 -> 88.39 
104 -> 91.65 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
129 -> 166.8 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
127 -> 184.31 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
135 -> 88.08 
110 -> 88.39 
104 -> 91.65 
136 -> 92.82 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
129 -> 166.8 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
127 -> 184.31 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
41 -> 56.93 
99 -> 56.93 
102 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
135 -> 88.08 
110 -> 88.39 
104 -> 91.65 
136 -> 92.82 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
129 -> 166.8 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
127 -> 184.31 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 
70 -> 41.29 
85 -> 43.15 
30 -> 48.82 
46 -> 50.53 
43 -> 54.69 
92 -> 54.87 
44 -> 55.92 
102 -> 56.93 
99 -> 56.93 
41 -> 56.93 
75 -> 61.47 
87 -> 83.67 
118 -> 84.02 
89 -> 85.39 
113 -> 87.95 
40 -> 87.98 
135 -> 88.08 
110 -> 88.39 
104 -> 91.65 
136 -> 92.82 
42 -> 95 
81 -> 100.29 
10 -> 103.56 
39 -> 105.19 
83 -> 106.85 
76 -> 114.73 
80 -> 117.83 
117 -> 117.99 
66 -> 119.92 
58 -> 127.33 
61 -> 135.56 
91 -> 139.44 
78 -> 154.7 
73 -> 162.77 
129 -> 166.8 
84 -> 170.9 
116 -> 172.37 
95 -> 175.22 
93 -> 181.8 
127 -> 184.31 
36 -> 187.57 
120 -> 194.8 
28 -> 196.4 
88 -> 197.34 
97 -> 198.68 
26 -> 198.94 
59 -> 226.06 
63 -> 290.16 

 

why does it do this? why only for asort()? and finally, can i extract both values if i do get this to order properly?

 

thanks!!!!!!!

Link to comment
Share on other sites

got it to work in the end using this:

 

<?php 


			while ($row = mysql_fetch_array($result)) {

				$p_postcode = explode(' ',$row['address_post_code']);
				$u_postcode_a = explode(' ',$u_postcode);
				$final_distance = return_distance($u_postcode_a[0], $p_postcode[0]);
				//array(id=>distance)
				if($final_distance <= $row['cover_distance']){
					$togs[$row['ID']] = $final_distance;
				}
			}

			asort($togs);
			foreach($togs as $key=>$value){
				$query_inrange .= $key . ',';
			}
?>

Link to comment
Share on other sites

the reason i am only wanting ID's and distance is i generate a SQL command using WHERE IN (ids).

 

What? You are running a query of all records to determine the distance and then run another query using the records within the specified distance? Why do that. Just run one query of all the records and determine the ones you need while processing them. That is going to be more efficient than running two queries.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.