<!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 6.5.7226.0">
<TITLE>PHP_Mapscript QueryByAttributes on PostGIS layer - bug or feature?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Hi List,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I'm trying to perform a QueryByAttributes operation on a PostGIS layer, but I get an error. Basically, it seems that the where clause being generated leaves out the attribute name and operator. Am I doing something wrong?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">My code is:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; $gotResult = $oLayer-&gt;queryByAttributes(&quot;roadname&quot;,&quot;EMERALD RD&quot;,MS_MULTIPLE);</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">My PHP error is:</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">[19-Sep-2006 08:53:34] PHP Warning:&nbsp; [MapServer Error]: prepare_database(): Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT roadname::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from roads WHERE (EMERALD RD) and (the_geom &amp;&amp; setSRID( 'BOX3D(-149999998.5 -99999999,149999998.5 99999999)'::BOX3D,find_srid('','roads','the_geom') ))' &lt;br&gt;&lt;br&gt;</FONT></P>

<P><FONT SIZE=2 FACE="Arial">It works if I do:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">$oLayer-&gt;queryByAttributes(&quot;roadname&quot;,&quot;roadname like 'EMERALD RD'&quot;,MS_MULTIPLE);</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Am I supposed to perform the QueryByAttributes operation differently for different data sources? It gets more difficult if I don't know in advance whether the type is text or number&#8230;.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I searched the list and bugzilla for something similar, but couldn't find it. I'm using php_mapscript 4.8.3 (I tried using 4.10beta2, but all my mapfiles get invalid map extent errors for some reason).</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Regards,</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Jacob</FONT>
</P>
<BR>

<P><B><FONT COLOR="#009500" FACE="Arial">J</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">ACOB</FONT> <FONT COLOR="#009500" FACE="Arial">D</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">ELFOS<BR>
</FONT><FONT COLOR="#009500" FACE="Arial">GIS</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial"></FONT> <FONT COLOR="#009500" FACE="Arial">A</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">NALYST</FONT><BR>
</B><FONT COLOR="#000000" SIZE=2 FACE="Arial">Maunsell Australia Pty Ltd<BR>
629 Newcastle Street, Leederville, WA 6007</FONT>

<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">PO Box 81, Leederville, WA 6902</FONT>

<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">Western Australia</FONT>

<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">ABN 20 093 846 925<BR>
<BR>
Tel     + 61 8 9281 6185<BR>
Fax    + 61 8 9281 6297<BR>
</FONT><U><FONT COLOR="#009C21" SIZE=2 FACE="Arial">jacob.delfos@maunsell.com</FONT></U>
</P>

</BODY>
</HTML>