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

Chris Green chris.green at ibstv.co.uk
Wed Jul 6 06:16:54 PDT 2011


Hello to all, especially PHP-Mapscript users:

 

Apologies for asking the same question twice, but I got no responses to the
below and I am still stuck on both problems. Very happy to receive some help
on either but especially the first one..

 

 

Chris 

 

From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Chris Green
Sent: 27 June 2011 09:05
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] php-Mapscript and MySQL layer syntax

 

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/20110706/19fd9def/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT02834.txt
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110706/19fd9def/attachment.txt>


More information about the MapServer-users mailing list