Based on this page, the Euclidean distance function requires 2 points (p1, p2) so a function to calculate it would be something like this:
function EuclideanDistance($p1x, $p1y, $p2x, $p2y) {
return sqrt(pow($p1x - $p2x, 2) + pow($p1y - $p2y, 2));
}
1 and 2 would presumably be input from the web page. The rest would be something like:
for ($m=1; $m<=$M; $m++) {
for ($l=1; $l<=$L; $l++) {
for ($j=1; $j<=$N; $j++) {
#do calculation here storing it in a 2D array
}
# select minimum here (perhaps min() function)
}
}
# use array sort
# use PHP vector class
# compute distance from vectors
# echo results in desired format
Either you should not be GROUPing BY the confno, or you should not be GROUPing BY and instead be searching only for a particular confno, or you should be including more data in the form so it's obvious that those three boxes are for three different confno values.
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.