[mapserver-users] php-Mapscript and MySQL layer syntax

Chris Green chris.green at ibstv.co.uk
Mon Jun 27 01:05:11 PDT 2011


Hi to all

 

I am using PHP5-Mapscript together with Mapserver 6.0 and I have a layer
which obtains its data from a MySQL database via an OGR connection. This all
works, but I am having trouble with two items of PHP-Mapscript syntax:

 

 

1.       $layer->getExtent() - I can't make this work with my layer: can
someone confirm if it works with a MySQL layer and if so give a syntax
example?

 

 

2.       $query= $layer->queryByAttributes(null, $expression, MS_MULTIPLE); 

 

 

On the 2nd question I came across some advice from Frank Wamerdam dated 2006
which said:

 

"The trick with OGR connections to pass the filter through to OGR is to use

a query expression starting with WHERE.  So you might do something like:

 

   expr = 'WHERE ' + $qField + ' = ' + $qValue

   $qLayer->queryByAttributes(null,$expr,MS_MULTIPLE);

 

(forgive my incorrect PHP syntax, I'm just trying to get the idea accross)."

 

 

However I can't come up with any expression that gives me any results at
all. Is there any current advice on how to do this kind of query over an OGR
connection?

 

 

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110627/319efefa/attachment.htm>


More information about the MapServer-users mailing list