double check between postgis and queryByAttribute

theresia freska frezzz_54 at YAHOO.COM
Tue Mar 20 22:57:02 EDT 2007


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.
does mapserver do this kind of check in the queryByAttribute? if yes, how can i access it?
thank you.

if ($_POST['mode'] == "itemnquery") {
  $qstring = $_POST['qstring'];
  $inputLayer = array('Highway', 'Street');
 
  //check whether the query layers are active or not
  if (array_intersect($inputLayer, $listLayer) != $inputLayer) {
   echo "<script language='Javascript'>alert('Query layer is not active.')</script>";
  } else {
   //if yes, check if user's input returns >1 name
   if ($_POST['qstring']) {
 
    $conn = pg_connect("host=".$host." dbname=".$database." user=".$user." password=".$password) or die ("Error connect!");
    $result = pg_query("select distinct road, class from tbRoad where road like '%$qstring%'");
 
    $m = 0;
    while ($row = pg_fetch_row($result)) {
     $res[$m] = $row;
     $m++;
    }
 
    $result_table = makeTable($res);
 
    //if it returns only 1 name, display the query map
    if (count($res)==1) {
 
     for ($k=0; $k<count($inputLayer); $k++) {
      $qLayer = $map->getLayerByName($inputLayer[$k]);
      $qry = "road LIKE '%" . $qstring . "%'";
      @$qLayer->queryByAttributes("road", $qry, MS_MULTIPLE);
 
      $showquery = TRUE;
      drawQueryRes();
     }
 
    }
 
   } else {
    echo "<script language='Javascript'>alert('Please fill the appropriate field.')</script>";
   }
  }
}

 
---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070320/a70b0cf6/attachment.html


More information about the mapserver-users mailing list