<pre class="code"><span class="keyword">hello, can someone pls check my code? just wonder if i use too much resource. seems like i do double check here, between postgis and queryByAttribute.<br>does mapserver do this kind of check in the queryByAttribute? if yes, how can i access it?<br>thank you.<br><br>if</span> ($_POST[<span class="literal">'mode'</span>] == <span class="literal">"itemnquery"</span>) {<br>  $qstring = $_POST[<span class="literal">'qstring'</span>];<br>  $inputLayer = <span class="keyword">array</span>(<span class="literal">'Highway'</span>, <span class="literal">'Street'</span>);<br> <br>  <span class="comment">//check whether the query layers are active or not<br></span>  <span class="keyword">if</span> (array_intersect($inputLayer, $listLayer) != $inputLayer) {<br>   <span class="keyword">echo</span> <span class="literal">"<script language='Javascript'>alert('Query layer is not active.')</script>"</span>;<br>  } <span
 class="keyword">else</span> {<br>   <span class="comment">//if yes, check if user's input returns >1 name<br></span>   <span class="keyword">if</span> ($_POST[<span class="literal">'qstring'</span>]) {<br> <br>    $conn = pg_connect(<span class="literal">"host="</span>.$host.<span class="literal">" dbname="</span>.$database.<span class="literal">" user="</span>.$user.<span class="literal">" password="</span>.$password) <span class="keyword">or</span> <span class="keyword">die</span> (<span class="literal">"Error connect!"</span>);<br>    $result = pg_query(<span class="literal">"select distinct road, class from tbRoad where road like '%$qstring%'"</span>);<br> <br>    $m = 0;<br>    <span class="keyword">while</span> ($row = pg_fetch_row($result)) {<br>     $res[$m] = $row;<br>     $m++;<br>    }<br> <br>    $result_table = makeTable($res);<br> <br>    <span class="comment">//if it returns only 1 name, display the query map<br></span>    <span
 class="keyword">if</span> (count($res)==1) {<br> <br>     <span class="keyword">for</span> ($k=0; $k<count($inputLayer); $k++) {<br>      $qLayer = $map->getLayerByName($inputLayer[$k]);<br>      $qry = <span class="literal">"road LIKE '%"</span> . $qstring . <span class="literal">"%'"</span>;<br>      @$qLayer->queryByAttributes(<span class="literal">"road"</span>, $qry, MS_MULTIPLE);<br> <br>      $showquery = TRUE;<br>      drawQueryRes();<br>     }<br> <br>    }<br> <br>   } <span class="keyword">else</span> {<br>    <span class="keyword">echo</span> <span class="literal">"<script language='Javascript'>alert('Please fill the appropriate field.')</script>"</span>;<br>   }<br>  }<br>}</pre><p>

<hr size=1>It's here! Your new message!<br>Get
<a href="http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/"> new email alerts</a> with the free <a href="
http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/">Yahoo! Toolbar.</a>