[Mapserver-users] PHP/Mapscript - Mapserver 4.0 - $oLayer->queryByAttributes()

Daniel Morissette morissette at dmsolutions.ca
Thu Oct 30 11:19:52 PST 2003


Have you tried the following?  If you use a logical expression then it 
is quite likely that the qitem argument is ignored:

[code]
$query = "('[".$Field1Name."]' = '".$Field1Value."' AND 
[".$Field2Name."] = ".$Field2Value.")";
@$myLayer->queryByAttributes("", $query, MS_MULTIPLE);
[/code]



Alexander Gabriel wrote:
> Hi there,
> 
> i've just updated from Mapserver 3.6 to Mapserver 4.0 and have a question on
> $oLayer->queryByAttributes();.
> In PHP/Mapscript from Mapserver3.6 i used to do this:
> 
> [code]
> $query = "('[".$Field1Name."]' = '".$Field1Value."' AND [".$Field2Name."] =
> ".$Field2Value.")";
> $oLayer->setFilter($query);
> @$myLayer->queryByAttributes(MS_MULTIPLE);
> [/code]
> 
> an it worked, if i zoomed to the extent of the Building via opening the
> Shapefile and getting the Extents of the Shape.
> 
> Now, the syntax of queryByAttributs is "int queryByAttributes(string qitem,
> string qstring, int mode)".
> But what if i want to find Shapes by more than one item?
> I've tried
> [code]
> $oLayer->queryByAttributes(array("Field1", "Field2"), array("Value1",
> "Value2"), MS_MULTIPLE);
> [/code]
> 
> [code]
> $oLayer->queryByAttributes("Field1, Field2", "Value1 Value2", MS_MULTIPLE);
> [/code]
> 
> and
> [code]
> $oLayer->queryByAttributes("Field1", "Value1", MS_MULTIPLE);
> $oLayer->queryByAttributes("Field2", "Value2", MS_MULTIPLE);
> [/code]
> 
> But nothing works :(
> 
> Can anyone please help me?
> 
> Thx
> Alexander Gabriel
> 




More information about the MapServer-users mailing list