在哪里说#get this to work是什么地方没有任何东西..我回应$ where,看起来所有的数据都在那里,但没有...
$zoom = '4';
$sql1 = "SELECT MIN(xcoord) AS min_x, MAX(xcoord) AS max_x, MIN(ycoord) AS min_y, MAX(ycoord) as max_y FROM adlplanet";
$result1 = mysql_query($sql1);
$row1 = mysql_fetch_array($result1);
# Create the extremes
$x_max = $row1['max_x'];
$x_min = $row1['min_x'];
$y_max = $row1['max_y'];
$y_min = $row1['min_y'];
# Calculate the size of the map based on the inputs from the user
$x_range = 800;
$y_range = 600;
$x_center = $x_max - $x_min - $x_range;
$y_center = $y_max - $y_min - $y_range;
$jump = 30;
#get this to working
$xlim = "(xcoord * $zoom) - $x_min - ($x_offset * $zoom) - ($x_center / 2)";
$ylim = "$y_max - (ycoord * $zoom) + ($y_offset * $zoom) - ($y_center / 2)";
$where = "($xlim > 0) AND ($xlim < $x_range) AND ($ylim > 0) AND ($ylim < $y_range)";
echo $where;
$sql2 = "SELECT * FROM adlPlanet where $where";
$result2 = mysql_db_query($sql2);
#$row2 = mysql_fetch_array($result2);
while ($row2 = mysql_fetch_array($result2)) {
echo $row2['PlanetKey'];
echo '<br><br> ';
}
答案 0 :(得分:0)
( * 4)
无法正常工作..请检查$x_offset
和$y_offset
是否已设置
答案 1 :(得分:0)
我认为你的问题在这里:
((xcoord * 4) - -605.3200
改变它:
$xlim = "(`xcoord` * $zoom) - ( $x_min )
- ( $x_offset * $zoom ) - ( $x_center / 2 )";
$ylim = "$y_max - (`ycoord` * $zoom) + ($y_offset * $zoom) - ($y_center / 2)";
$where = "($xlim > 0) AND ($xlim < $x_range)
AND ($ylim > 0) AND ($ylim < $y_range)";