ほぼ動作するようになりました。表で結果を取得できますが、何らかの理由で、結果が正しくありません。
座標 x 100 & y 100 を検索します
x 74-125 & y 74-125 ではなく、x 1-25 & y 1-25 のみの結果が得られます
<?php
$x = $_POST['x'];
$y = $_POST['y'];
mysql_connect ("localhost","user","pass") or die (mysql_error());
mysql_select_db ("db");
$res = mysql_query("select * FROM table WHERE (x between $x-25 AND $x+25) AND (y BETWEEN $y-25 AND $y+25)");
echo "<table border='1' align='center' cellpadding='5'>";
echo "<tr> <th>City Name</th> <th>X</th> <th>Y</th> </tr>";
// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array( $res )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['cityname'] . '</td>';
echo '<td>' . $row['x'] . '</td>';
echo '<td>' . $row['y'] . '</td>';
echo "</tr>";
}
// close table>
echo "</table>";
?>