[Mapserver-users] Sending String Logical Expressions

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


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