[Mapserver-users] Sending String Logical Expressions

woodbri at swoodbridge.com woodbri at swoodbridge.com
Wed Apr 2 14:14:59 EST 2003


Didn't fix it ... well maybe some others have an idea.
The problem I had was not related to mapscript, it was in pattern 
field of a call ereg_replace() and it complained about an invalid 
regular expression so it must have passed the string without doing 
the variable substitution directly as the regex, but the change I 
made forced it to eval the expression and pass the result to regex.

-Steve

On 2 Apr 2003 at 12:11, James Vogl wrote:

> Hi Steve,
>  Thank you for your quick reply to my problem. Unfortunately, my query
>  still
> refuses to work with string fields. Might I sneak a peek at your PHP
> file to see where else I may be wrong? James
> 
> -----Original Message-----
> From: woodbri at swoodbridge.com [mailto:woodbri at swoodbridge.com]
> Sent: Wednesday, April 02, 2003 11:27 AM
> To: mapserver-users at lists.gis.umn.edu; James Vogl
> Subject: Re: [Mapserver-users] Sending String Logical Expressions
> 
> 
> James,
> 
> Try  $qclass->setexpression("(". ${qstring}. ")");
> I have run into a case on PHP4 today where this worked but you
> example did not. Not sure why, just happy to have a fix :)
> 
> -Steve W.
> 
> On 2 Apr 2003 at 10:45, James Vogl wrote:
> 
> > Hi All,
> > The write-up PHPMapScriptMySQLShapeFiles for the mapserver-users
> > forum was instrumental in getting me started in PHP and Mapscipt.
> > However, I've come across a problem I haven't been able to solve.
> >  I have constructed a simple HTML web form in which users enter a
> >  SQL-like
> > formula into a single textbox. Using a simple GET form and submit
> > button, the single textbox value gets sent to a PHP file. The method
> > works fine for queries on numeric fields in which the user enters:
> >
> >      [Block]= 500 and [I_o] = 1.
> >
> > But Mapserver fails to return any results when a text field is
> > specified like so:
> >
> >      '[Street_Nam]' = "MAIN"
> >
> > or to avoid sending special characters:
> >
> >      ‘[Street_nam]’="MAIN"
> >
> > By using the echo command in the receiving PHP I'm able to confirm
> > that the proper string is being sent:
> >
> >      echo "<br>The string sent is $qstring<br>";
> > In this case value returned is:
> >      The string sent is '[Street_Nam]’=\"MAIN\"
> >
> > If I explicitly specify the value for setexpression as such:
> >      $qclass->setexpression("('[Street_Nam]' = \"MAIN\")");
> > the query works fine.
> > However, the following expression does not:
> >      $qclass->setexpression("(${qstring})");
> >
> > I wonder if the problem may be a lack of clarity as to how PHP
> > parses string variables.
> >
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> >
> 
> 
> 
> 






More information about the mapserver-users mailing list