<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="+1"><font face="sans-serif">I'm trying to understand how to
do querying via PHP mapscript, and I don't understand the results I'm
getting. Basically I'm querying a polygon layer of US States with a
rectangle that intersects 8 states in the upper midwest. It fully
encloses two of these. The following script seems to find only one
result and it says the shapeindex is 42. Now I know this is the answer
to the meaning of life, the universe and everything, but how do I use
this to get a list of the state names that were found (and why is it
only returning 1 found?)<br>
<br>
What I want to do eventually is display these states on the map in a
highlighting color to show they were selected. If I'm going about this
all wrong, could somebody clue me in?<br>
<br>
&nbsp;&nbsp; $rect = ms_newRectObj();<br>
&nbsp;&nbsp; $rect-&gt;setextent(-50000, -50000, 50000, 50000);<br>
&nbsp;&nbsp; $lyr = $map-&gt;getLayer(1);&nbsp; // states layer<br>
&nbsp;&nbsp; $results = $lyr-&gt;queryByRect($rect);<br>
&nbsp;&nbsp; if ($results == MS_FAILURE) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "Nothing found.&lt;br /&gt;";<br>
&nbsp;&nbsp; } else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "Found " . $lyr-&gt;getNumResults()."&lt;br /&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for ($i=0; $i&lt;$lyr-&gt;getNumResults(); $i++) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $rcache = $lyr-&gt;getResult($i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "&nbsp;&nbsp; shapeindex: ".$rcache-&gt;shapeindex;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp; }<br>
&nbsp;&nbsp; $rect-&gt;free();<br>
<br>
<br>
</font></font>
</body>
</html>