<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1586" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=218174413-25022007><FONT face="Courier New" 
size=2>Nimalika,</FONT></SPAN></DIV>
<DIV><FONT face="Courier New"><FONT size=2><SPAN class=218174413-25022007><FONT 
face="Courier New" size=2></FONT></SPAN></FONT></FONT> </DIV>
<DIV><SPAN class=218174413-25022007><FONT face="Courier New" size=2>You are only 
selecting the geom from the table.  You should also select any other 
columns that you may be using for labeling, filtering, etc in your .map 
file.</FONT></SPAN></DIV>
<DIV><FONT face="Courier New"><FONT size=2><SPAN class=218174413-25022007><FONT 
face="Courier New" size=2></FONT></SPAN></FONT></FONT> </DIV>
<DIV><SPAN class=218174413-25022007> </DIV>
<DIV><FONT face="Courier New" size=2>DATA "the_geom from (select 
alldsdivisions.dsd_n<SPAN class=218174413-25022007>, 
</SPAN>alldsdivisions.the_geom as the_geom from alldsdivisions where 
alldsdivisions.dsd_n ='%qstring%')<BR>   AS selectedgs<BR>   
USING UNIQUE oid USING SRID=-1"</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2></FONT></FONT> </DIV>
<DIV><SPAN class=218174413-25022007><FONT face="Courier New" 
size=2>Drew</FONT></SPAN></SPAN></DIV>
<BLOCKQUOTE>
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> 
  postgis-users-bounces@postgis.refractions.net 
  [mailto:postgis-users-bounces@postgis.refractions.net]<B>On Behalf Of 
  </B>nimalika fernando<BR><B>Sent:</B> Sunday, February 25, 2007 2:06 
  AM<BR><B>To:</B> postgis-users@postgis.refractions.net<BR><B>Subject:</B> 
  [postgis-users] problem in dynamic SQL with Mapserver<BR><BR></FONT></DIV>
  <DIV>Hi everybody,</DIV>
  <DIV> </DIV>
  <DIV>I'm working with some post-disaster management support tool with mapping 
  forcusing on Tsunami Rehabilation.</DIV>
  <DIV> </DIV>
  <DIV>I have managed to use postGIS / UMN mapserver for basic stuff like 
  select data from different tables , join them and dislaying 
  information according to predefined selections.</DIV>
  <DIV> </DIV>
  <DIV>Now I want to add a very simple serching facility. For an example if user 
  already knows the name of an affected village name,by selecting 
  the name ( from a drop down menu), the area should be highlighed on 
  the map.</DIV>
  <DIV> </DIV>
  <DIV>I tried to pass user selection as a variable to postGIS query but I 
  failed.</DIV>
  <DIV>code segment is as follows</DIV>
  <DIV> </DIV>
  <DIV>DATA "the_geom from (select alldsdivisions.the_geom as the_geom from 
  alldsdivisions where alldsdivisions.dsd_n ='%qstring%')<BR>   AS 
  selectedgs<BR>   USING UNIQUE oid USING SRID=-1"</DIV>
  <DIV> </DIV>
  <DIV>qstring is the variable name use in HTML file.It is replaced by user 
  selection dynamically.</DIV>
  <DIV>alldsdivisions is the relation name and dsd_n is the column name of 
  village names.</DIV>
  <DIV> </DIV>
  <DIV>i get following error message</DIV>
  <DIV> </DIV>
  <DIV>prepare_database(): Query error. Error executing POSTGIS DECLARE (the 
  actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT 
  dsd_n::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),oid::text 
  from (select alldsdivisions.the_geom as the_geom from alldsdivisions where 
  alldsdivisions.dsd_n ='Ambalantota') AS selectedgs WHERE (Ambalantota) and 
  (the_geom && setSRID( 'BOX3D(181659.373889 
  74242.41425975,303213.047119 165407.66918225)'::BOX3D,-1) )' 
  <BR><BR>Postgresql reports the error as 'ERROR: column "dsd_n" does not exist 
  '<BR><BR>but dsd_n column do exist .</DIV>
  <DIV> </DIV>
  <DIV>I can't figureout how to handle this. </DIV>
  <DIV>any help is highly appriciated.</DIV>
  <DIV> </DIV>
  <DIV> </DIV>
  <DIV>thanking in advance.</DIV>
  <DIV> </DIV>
  <DIV>nimalika</DIV>
  <DIV>( from Sri Lanka-island in indian ocean)</DIV>
  <DIV> </DIV>
  <DIV> </DIV>
  <DIV> </DIV>
  <P>
  <HR SIZE=1>
  Finding fabulous fares is fun.<BR><A 
  href="http://farechase.yahoo.com/promo-generic-14795097;_ylc=X3oDMTFtNW45amVpBF9TAzk3NDA3NTg5BF9zAzI3MTk0ODEEcG9zAzEEc2VjA21haWx0YWdsaW5lBHNsawNxMS0wNw--">Let 
  Yahoo! FareChase search your favorite travel sites</A> to find flight and 
  hotel bargains.</BLOCKQUOTE></BODY></HTML>