Mapscript/PHP help me display tabular results of my query (queryByAttributes)
John B. Churchill
jchurchill at AL.UMCES.EDU
Wed Jun 13 13:26:30 PDT 2007
Hi,
I have been looking through the Mapscript API and can't find what I'm
looking for. I'm just asking for help with a tip as to where to look.
I'm trying to display the results of my query.
++++++++++++++ BEGIN CODE ++++++++++++++++++
<?php
dl('php_mapscript.dll');
list($layername, $field) = split(",", $_GET['q']); // q is the value of
what was selected
$options = array();
$map_path="C:\\ms4w\\Apache\htdocs\\img_browser\\";
$map_file="imgb_access.map";
$map = ms_newMapObj($map_path.$map_file);
switch($layername) {
case 'landsat_4':
$layernum = 3;
$qstring = "Landsat";
break;
case 'ikonos':
$layernum = 4;
$qstring = "Ikonos";
break;
case 'hyperion':
$layernum = 5;
$qstring = "Hyperion";
break;
case 'mn_airphotos':
$layernum = 6;
$qstring = "MN DNR";
break;
}
$layer = $map->getlayer($layernum);
$success = $layer->queryByAttributes($field, $qstring, MS_MULTIPLE);
$layer->open();
for ($i = 0; $i <= $layer->getnumresults();$i += 1) {
$resultx = $layer->getResult($i);
// THIS Does NOT give me what I'm after
print "<pre>";
print_r($resultx); // print_r($resultx);
print "</pre>";
}
++++++++++++++ END OF CODE ++++++++++++++++++
The last section (with print_r) shows me the result of my query but not
in the form that I want. I want to see the records in the dbf table of
the shapefile that I have queried. What am I doing wrong ?
--
---------------------------------------------
John B. Churchill, M.S. http://alx.al.umces.edu/~jchurch/
GIS Specialist (301) 689-7109
University of Maryland Center for Environmental Science
Appalachian Laboratory http://www.al.umces.edu/
Environmental Science Education http://alese.al.umces.edu/
301 Braddock Road
Frostburg, MD 21532
More information about the MapServer-users
mailing list