[Mapserver-users] listing field names of my $oShape->values; (Because it's Friday???)

Denis Lalonde denlalonde at yahoo.com
Fri Feb 27 12:34:57 PST 2004


--0-902877681-1077914097=:78758
Content-Type: text/plain; charset=us-ascii

Hello all,
I'm simply trying to get a list of the field names of a layer...
I'm using php & mapscipt 4 and accessing my MapInfo data (OGR)
Here's my code that's not working (I get "Undefined offset" error when accessing the array):
I have my results and my layer set; the result of my echo sizeof($flds) is 20 which is good. The item that I am querying does have data in all 20 fields.

                    $oRes = $oLayer->getResult($iRes);
                    $oShape = $oLayer->getShape(-1,$oRes->shapeindex);
                    
                    $flds=$oShape->values;
                    echo "numfields: ".sizeof($flds)."<br>";
                    for ($fieldcount=0; $fieldcount < sizeof($flds); $fieldcount++)
                        {
                           echo $flds[$fieldcount];
                        }
 
should that not spit me out my field names?
 
Thanks


---------------------------------
Do you Yahoo!?
Get better spam protection with Yahoo! Mail
--0-902877681-1077914097=:78758
Content-Type: text/html; charset=us-ascii

<DIV>Hello all,</DIV>
<DIV>I'm simply trying to get a list of the field names of a layer...</DIV>
<DIV>I'm using php & mapscipt 4 and accessing my MapInfo data (OGR)</DIV>
<DIV>Here's my code that's not working (I get "Undefined offset" error when accessing the array):</DIV>
<DIV>I have my results and my layer set; the result of my echo sizeof($flds) is 20 which is good. The item that I am querying does have data in all 20 fields.</DIV>
<DIV><BR>                    $oRes = $oLayer->getResult($iRes);<BR>                    $oShape = $oLayer->getShape(-1,$oRes->shapeindex);<BR>                    <BR>                    $flds=$oShape->values;<BR>                    echo "numfields: ".sizeof($flds)."<br>";<BR>                    for ($fieldcount=0; $fieldcount < sizeof($flds);
 $fieldcount++)<BR>                        {<BR>                           echo $flds[$fieldcount];<BR>                        }</DIV>
<DIV> </DIV>
<DIV>should that not spit me out my field names?</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
Get better spam protection with <a href="http://us.rd.yahoo.com/mailtag_us/*http://antispam.yahoo.com/tools">Yahoo! Mail</a>
--0-902877681-1077914097=:78758--



More information about the MapServer-users mailing list