[Mapserver-users] Read all fields of dbf file when querying

Daniel Morissette morissette at dmsolutions.ca
Thu Aug 7 10:47:20 EDT 2003


Stefan Schwarzer wrote:
> Thanks Daniel,
> 
> but unfortunately I do not know the names of the fields, so that I can't 
> access the fields like "$population = $shape->values["Population"];", 
> but rather I should retrieve the results by using the column-number [0, 
> 1, 2, ....]. But this does not work. Any further suggestion?
> 

You could possibly walk the array using the following kind of loop ot 
either dump the values or figure the name of the fields.
(This is untested code BTW)

   while( list($key, $val) = each( $shape->values ) )
   {
     echo $key . " = " . $val;
   }

Daniel
-- 
------------------------------------------------------------
  Daniel Morissette               morissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------




More information about the mapserver-users mailing list