<meta http-equiv="content-type" content="text/html; charset=utf-8"><div>In mapserver you can specify the desired SQL query with variables in the DATA section and create a template for it (example is for Postgis but works for MSSQL in a similar way)</div>
<div><div>CONNECTIONTYPE POSTGIS</div><div>CONNECTION &quot;dbname=yourdatabasename user=yourdbusername&quot;</div><div>DATA &quot;the_geom from (select g.gid, g.the_geom, a.attr1, a.attr2 from geotable g join attrtable a on g.gid = a.aid) as subquery unique gid using srid=4326&quot;</div>
</div><div><br></div><div>You can avoid mapserver template&#39;s for querying if you </div><div>1) Want to do it from PHP anyway </div><div>2) You don&#39;t specifically need it in WMFS/WFS GetFeatureInfo format</div><div>
For example create info.php that queries your databse and returns the geometry as WKT and needed attributes, convert them to JSON/XML and send back to web-browser where it can be easily read and displayed by OpenLayers.</div>
<div><br></div><div class="gmail_quote">On Fri, Dec 10, 2010 at 12:35 PM, Marcus <span dir="ltr">&lt;<a href="mailto:the_incredibal@gmx.de">the_incredibal@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">












<div lang="DE" link="blue" vlink="purple">

<div>

<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:10.0pt;font-family:Arial">Hello,</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:10.0pt;font-family:Arial">I am a cartography student from Germany und I am working on my
diploma thesis at the moment. My task is to plan and create a webservice
application for a transportation company and I decided to use the UMN Mapserver
for the implementation. The users should have the ability to query the objects,
too. As you probably know the query function of Mapserver allows to query the
attribute table or to join another table-file, but now there’s my
question: Is it possible to create a query which directly connects to an
existing database via PHP and show the results in a query template? I have
doubts that this could work, cause the query function uses mapserver variables
which are converted into the strings or numbers like they are in the attribute
table by the Mapserver program and in my opinion a database won’t
understand these variables. But may be you’ve heard of a possibility and
I would be glad if anyone could help me. Please keep in my mind that I have to
use a Microsoft SQL Server 2008 database and sqlserv as the
“driver”.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:10.0pt;font-family:Arial">Thank you and best regards from Germany.</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-GB" style="font-size:10.0pt;font-family:Arial">Marcus</span></font></p>

<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial"> </span></font></p>

</div>

</div>


<br>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://iap.md">http://iap.md</a>, The future is open<br>