[Mapserver-users] listing field names of my $oShape->values; (Because it's Friday???)
FX Gamoy
fx.gamoy at mapxplore.com
Fri Feb 27 13:32:31 PST 2004
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01C3FD81.96B1A960
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
hello
try=20
print_r($oShape);
or
print_r($oShape->values);
fx gamoy
http://www.mapxplore.com/
----- Original Message -----=20
From: Denis Lalonde=20
To: mapserver-users at lists.gis.umn.edu=20
Sent: Friday, February 27, 2004 9:34 PM
Subject: [Mapserver-users] listing field names of my $oShape->values; =
(Because it's Friday???)
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 =3D $oLayer->getResult($iRes);
$oShape =3D =
$oLayer->getShape(-1,$oRes->shapeindex);
=20
$flds=3D$oShape->values;
echo "numfields: ".sizeof($flds)."<br>";
for ($fieldcount=3D0; $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
------=_NextPart_000_000A_01C3FD81.96B1A960
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hello</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>try </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print_r($oShape);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>or</FONT></DIV><FONT face=3DArial=20
size=3D2>print_r($oShape->values);</FONT>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>fx gamoy</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.mapxplore.com/">http://www.mapxplore.com/</A></FONT></=
DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3Ddenlalonde at yahoo.com =
href=3D"mailto:denlalonde at yahoo.com">Denis=20
Lalonde</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
title=3Dmapserver-users at lists.gis.umn.edu=20
=
href=3D"mailto:mapserver-users at lists.gis.umn.edu">mapserver-users at lists.g=
is.umn.edu</A>=20
</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, February 27, 2004 =
9:34=20
PM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Mapserver-users] =
listing field=20
names of my $oShape->values; (Because it's Friday???)</DIV>
<DIV><BR></DIV>
<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=20
accessing the array):</DIV>
<DIV>I have my results and my layer set; the result of my echo =
sizeof($flds)=20
is 20 which is good. The item that I am querying does have data in all =
20=20
fields.</DIV>
=
<DIV><BR> &nbs=
p; =20
$oRes =3D=20
=
$oLayer->getResult($iRes);<BR> &nbs=
p;  =
;=20
$oShape =3D=20
=
$oLayer->getShape(-1,$oRes->shapeindex);<BR>  =
; =
=20
=
<BR> &nb=
sp; =20
=
$flds=3D$oShape->values;<BR> =
=
echo "numfields:=20
=
".sizeof($flds)."<br>";<BR> &nbs=
p;  =
;=20
for ($fieldcount=3D0; $fieldcount < sizeof($flds);=20
=
$fieldcount++)<BR> &=
nbsp; &n=
bsp; =20
=
{<BR> &n=
bsp; &nb=
sp; =20
echo=20
=
$flds[$fieldcount];<BR> &n=
bsp; &nb=
sp; =20
}</DIV>
<DIV> </DIV>
<DIV>should that not spit me out my field names?</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<P>
<HR SIZE=3D1>
Do you Yahoo!?<BR>Get better spam protection with <A=20
=
href=3D"http://us.rd.yahoo.com/mailtag_us/*http://antispam.yahoo.com/tool=
s">Yahoo!=20
Mail</A></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_000A_01C3FD81.96B1A960--
More information about the MapServer-users
mailing list