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

Alexander Gabriel alexander.gabriel at blubbermania.com
Thu Oct 30 09:13:00 PST 2003


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