<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.24">
<TITLE>RE: [Chameleon] Problem with executeQuery</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>If you get a blank page, what does your PHP error log say?</FONT>
</P>

<P><FONT SIZE=2>Put log_errors On in php.ini, and set and error log file.</FONT>
</P>

<P><FONT SIZE=2>Best regards,</FONT>
<BR><FONT SIZE=2>Bart</FONT>
</P>

<P><FONT SIZE=2>-----Oorspronkelijk bericht-----</FONT>
<BR><FONT SIZE=2>Van: chameleon-bounces@lists.maptools.org</FONT>
<BR><FONT SIZE=2>[<A HREF="mailto:chameleon-bounces@lists.maptools.org">mailto:chameleon-bounces@lists.maptools.org</A>]Namens ventouse@free.fr</FONT>
<BR><FONT SIZE=2>Verzonden: vrijdag 19 mei 2006 11:05</FONT>
<BR><FONT SIZE=2>Aan: chameleon@lists.maptools.org</FONT>
<BR><FONT SIZE=2>Onderwerp: [Chameleon] Problem with executeQuery</FONT>
</P>
<BR>

<P><FONT SIZE=2>Hi !</FONT>
</P>

<P><FONT SIZE=2>I've read the tiki pages about the custom query (executequery in</FONT>
<BR><FONT SIZE=2>query-utils.php), and I still have problems making this thing work.</FONT>
</P>

<P><FONT SIZE=2>Here is my code</FONT>
</P>

<P><FONT SIZE=2>In html main page</FONT>
</P>

<P><FONT SIZE=2>&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;</FONT>
<BR><FONT SIZE=2>function myOnLoad()</FONT>
<BR><FONT SIZE=2>&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; CWC2OnLoadFunction();</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; goEventManager.registerForEvent( 'ON_QUERY', 'myOnQuery' );</FONT>
<BR><FONT SIZE=2>&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp; &lt;/script&gt;</FONT>
<BR><FONT SIZE=2>&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;</FONT>
<BR><FONT SIZE=2>&nbsp; function myOnQuery(nX,nY)</FONT>
<BR><FONT SIZE=2>&nbsp; {</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var</FONT>
<BR><FONT SIZE=2>url='query.phtml?=&amp;x'+nX+'&amp;y='+nY+'&amp;sid='+document.forms[0].sid.value ;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window.open(url,'eventwin',width=500,height=600);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
</P>

<P><FONT SIZE=2>And in query.phtml</FONT>
</P>

<P><FONT SIZE=2>// check for a session</FONT>
<BR><FONT SIZE=2>if( !isset( $_GET[ 'sid'] ) )</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; die('no session detected');</FONT>
</P>

<P><FONT SIZE=2>// define some vars</FONT>
<BR><FONT SIZE=2>define(&quot;LOAD_MAPSESSION&quot;, 1);</FONT>
<BR><FONT SIZE=2>define( 'CHAMELEON_PATH', '/ms4w/apps/chameleon/htdocs/');</FONT>
</P>

<P><FONT SIZE=2>// include the supporting php functions</FONT>
<BR><FONT SIZE=2>include(CHAMELEON_PATH.&quot;widgets/session.inc.php&quot;);</FONT>
<BR><FONT SIZE=2>include(CHAMELEON_PATH.&quot;widgets/query_utils.php&quot;);</FONT>
</P>
<BR>

<P><FONT SIZE=2>// execute the query based on passed coords and the mapsession</FONT>
<BR><FONT SIZE=2>$aResults = executeQuery( $oMapSession, $_GET['x'], $_GET['y'] );</FONT>
</P>
<BR>

<P><FONT SIZE=2>&nbsp;&nbsp; foreach( $aResults as $nLayerIdx =&gt; $aResult )</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; {&nbsp;&nbsp; echo $nLayerIdx;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $oLayer = $oMapSession-&gt;oMap-&gt;getLayer($nLayerIdx);</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $szName = $oLayer-&gt;name;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach($aResult as $aRow)</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo 'Layer Name: ' . $szName . '&lt;br&gt;';</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp; }</FONT>
</P>

<P><FONT SIZE=2>The whole code seems to work well except i get a blank page in my result popup</FONT>
<BR><FONT SIZE=2>window...</FONT>
</P>

<P><FONT SIZE=2>The adress of the generated result.phtml seems good (eg :</FONT>
<BR><FONT SIZE=2><A HREF="http://localhost/chameleon/samples/query.phtml?=&x95&y=71&sid=446d87ea5a88b" TARGET="_blank">http://localhost/chameleon/samples/query.phtml?=&x95&y=71&sid=446d87ea5a88b</A>)</FONT>
<BR><FONT SIZE=2>and the sid seem to have been transmitted (isnt't it ?).</FONT>
<BR><FONT SIZE=2>In addition i've tried and use the usual query widget and there's no problem</FONT>
<BR><FONT SIZE=2>getting the shape file info.</FONT>
<BR><FONT SIZE=2>So, is it a session related problem ?</FONT>
</P>

<P><FONT SIZE=2>Thanx in advance</FONT>
</P>

<P><FONT SIZE=2>E. SEGUIN</FONT>
</P>

<P><FONT SIZE=2>PS : the map file code if it could be useful.</FONT>
</P>

<P><FONT SIZE=2>LAYER</FONT>
<BR><FONT SIZE=2>&nbsp; NAME monde</FONT>
</P>

<P><FONT SIZE=2>&nbsp; METADATA</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; &quot;DESCRIPTION&quot; &quot;Syst&amp;#1080;me G&amp;#1081;od&amp;#1081;sique&quot;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; &quot;GROUP&quot; &quot;Polygon&quot;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; &quot;LAYER&quot; &quot;Syst&amp;#1080;me G&amp;#1081;od&amp;#1081;sique&quot;</FONT>
<BR><FONT SIZE=2>&nbsp; END</FONT>
<BR><FONT SIZE=2>&nbsp; TYPE POLYGON</FONT>
<BR><FONT SIZE=2>&nbsp; STATUS ON</FONT>
<BR><FONT SIZE=2>&nbsp; DATA monde</FONT>
<BR><FONT SIZE=2>&nbsp; CLASS</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTLINECOLOR 50 50 50</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 255 255 155</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp; END</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TEMPLATE &quot;dummy.html&quot;</FONT>
<BR><FONT SIZE=2>END # layer</FONT>
</P>
<BR>
<BR>
<BR>

<P><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>Chameleon mailing list</FONT>
<BR><FONT SIZE=2>Chameleon@lists.maptools.org</FONT>
<BR><FONT SIZE=2><A HREF="http://lists.maptools.org/mailman/listinfo/chameleon" TARGET="_blank">http://lists.maptools.org/mailman/listinfo/chameleon</A></FONT>
</P>

<BR>


Disclaimer
************************************************************************
Aan dit bericht kunnen geen rechten worden ontleend. Dit bericht is
uitsluitend bestemd voor de geadresseerde. Als u dit bericht per abuis
hebt ontvangen, wordt u verzocht het te vernietigen en de afzender te 
informeren. Wij adviseren u om bij twijfel over de juistheid of de 
volledigheid van de mail contact met afzender op te nemen.

This message shall not constitute any rights or obligations.
This message is intended solely for the addressee.
If you have received this message in error, please delete it and
notify the sender immediately. When in doubt whether this message
is correct or complete, please contact the sender.
************************************************************************

<BR>
</BODY>
</HTML>