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

Chris Green chris.green at ibstv.co.uk
Mon Jun 27 04:05:11 EDT 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-0001.html


More information about the mapserver-users mailing list