<!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><script language="JavaScript" type="text/javascript"></FONT>
<BR><FONT SIZE=2>function myOnLoad()</FONT>
<BR><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> CWC2OnLoadFunction();</FONT>
<BR><FONT SIZE=2> goEventManager.registerForEvent( 'ON_QUERY', 'myOnQuery' );</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> </script></FONT>
<BR><FONT SIZE=2><script language="JavaScript" type="text/javascript"></FONT>
<BR><FONT SIZE=2> function myOnQuery(nX,nY)</FONT>
<BR><FONT SIZE=2> {</FONT>
</P>
<P><FONT SIZE=2> var</FONT>
<BR><FONT SIZE=2>url='query.phtml?=&x'+nX+'&y='+nY+'&sid='+document.forms[0].sid.value ;</FONT>
<BR><FONT SIZE=2> window.open(url,'eventwin',width=500,height=600);</FONT>
<BR><FONT SIZE=2> }</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> die('no session detected');</FONT>
</P>
<P><FONT SIZE=2>// define some vars</FONT>
<BR><FONT SIZE=2>define("LOAD_MAPSESSION", 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."widgets/session.inc.php");</FONT>
<BR><FONT SIZE=2>include(CHAMELEON_PATH."widgets/query_utils.php");</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> foreach( $aResults as $nLayerIdx => $aResult )</FONT>
<BR><FONT SIZE=2> { echo $nLayerIdx;</FONT>
<BR><FONT SIZE=2> $oLayer = $oMapSession->oMap->getLayer($nLayerIdx);</FONT>
<BR><FONT SIZE=2> $szName = $oLayer->name;</FONT>
<BR><FONT SIZE=2> foreach($aResult as $aRow)</FONT>
</P>
<P><FONT SIZE=2> {</FONT>
<BR><FONT SIZE=2> echo 'Layer Name: ' . $szName . '<br>';</FONT>
</P>
<P><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> }</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> NAME monde</FONT>
</P>
<P><FONT SIZE=2> METADATA</FONT>
<BR><FONT SIZE=2> "DESCRIPTION" "Syst&#1080;me G&#1081;od&#1081;sique"</FONT>
<BR><FONT SIZE=2> "GROUP" "Polygon"</FONT>
<BR><FONT SIZE=2> "LAYER" "Syst&#1080;me G&#1081;od&#1081;sique"</FONT>
<BR><FONT SIZE=2> END</FONT>
<BR><FONT SIZE=2> TYPE POLYGON</FONT>
<BR><FONT SIZE=2> STATUS ON</FONT>
<BR><FONT SIZE=2> DATA monde</FONT>
<BR><FONT SIZE=2> CLASS</FONT>
<BR><FONT SIZE=2> OUTLINECOLOR 50 50 50</FONT>
<BR><FONT SIZE=2> COLOR 255 255 155</FONT>
<BR><FONT SIZE=2> END</FONT>
</P>
<P><FONT SIZE=2> TEMPLATE "dummy.html"</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>