[Mapserver-users] QueryByAttribute

Paul Spencer spencer at dmsolutions.ca
Wed Apr 28 05:06:13 PDT 2004


I don't remember if php will produce a warning on this line but, for 
instance, C compilers will not and will actually assign the value of 
MS_FAILURE to oQueryStatus successfully which will evaluate to true in 
the if and then you will never find a result.

It is also possible that you are turning off error reporting at the 
level that this would be reported at (if it is an error).  For instance, 
most people set error_reporting = EALL & ~ENOTICE (because that is the 
default in php.ini) and never see notices.

And I just tried this ... it does not give you an error.  It does assign 
the value and return true ... so in your case it will always enter the 
if as if the query had failed.

Cheers,

Paul

Norbert Thieme wrote:
> Hi,
> 
> Don't you get an error message if you launch queryByAttributes. If you 
> don't use the @ before there should be a message if an error occurs. If 
> not there must be something wrong in the script.
> 
> I think you didn't copy/paste the code? Sorry for the question because I 
> think php would in the other case report an error on the line with:
> 
>    if ( $oQueryStatus = MS_FAILURE )
> 
> because "==" instead of "=".
> 
> I don't know if this helps you but here is a snippet from the code I 
> use. Even if I use queryByPoint you can try to use your 
> queryByAttributes the same way:
> 
> if (@$layer->queryByPoint($q_point, $q_mode, 0) == MS_SUCCESS)
> {
>   $res_count = $layer->getnumresults();
>   for ($i=0; $i < $res_count; $i++)
>   {
>     $result = $layer->getResult($i);
>     ....
>   }
> }
> 
> I don't know if this solves the problem but I hope it will help you.
> 
> Regards,
> Norbert
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           pspencer at dmsolutions.ca   |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------




More information about the MapServer-users mailing list