Q:

Coordinate search

Have it almost working now. I can get results in the table but for some reason, they are not quite right.
I search coords x 100 & y 100
I get results of x 1-25 & y 1-25 only rather than x 74-125 & y 74-125

<?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>";
?>

A:

As I give you this, remember that doing it in the fashion you are opens you wide up to SQL Injection, and that you should really use PDO or similar for prepared statements.  That being said:
$x = (intval)$_POST['fld_x'];
$y = (intval)$_POST['fld_y'];

$res = mysql_query("select * FROM my_dbase WHERE (x between $x-25 AND $x+25) AND (y BETWEEN $y-25 AND $y+25)");
$data = array();
while($row = mysql_fetch_assoc($res)) {
    $data[] = $row;
}

Then do what you will with the $data
Example SQL Fiddle
EDIT
To make sure the database is connecting properly, please change/add the following where needed:
if(!mysql_select_db ("dbase")) {
    die(mysql_error());
}

after after $res = mysql_query... put:
if(!$res) {
    die("Query Failed: ".mysql_error());
}

EDIT
The full code for you based on what you currently have:
You showed the HTML earlier as:
<form action="xysearch.php" method="get">
<label>X Coord
<input type="text" name="fld_x" />
</label>
<label>Y Coord
<input type="text" name=fld_y" />
</label>
<input type="submit" value="Search" />
</form>

and the PHP would be:
<?php

$x = (intval)$_POST['fld_x'];
$y = (intval)$_POST['fld_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>";
?>

