[ciapug] Multi-dimensional array
Chris Hettinger
ciapug@cialug.org
Mon, 17 Nov 2003 11:51:58 -0600
Thanks guys,
Laith, your example was right on with the way I had started to go, so =
that's cool, I wasn't as far off as I thought I was.
-ch
-----Original Message-----
From: Lathrop Preston [mailto:laith@prestonfam.org]
Sent: Monday, November 17, 2003 11:36 AM
To: ciapug@cialug.org
Subject: Re: [ciapug] Multi-dimensional array
Mixed pseudo/real code
LOOP FOR RECSET
IF TEST PASS
$passed_array[] =3D array( "ssn" =3D> RECSET(ssn), "dob" =3D> =
RECSET(dob),=20
"joined" =3D> RECSET(joined));
END LOOP
to count records just do
$rec_count =3D count($passed_array);
the resultant array will be like this
array(
0 =3D> array("ssn" =3D> ######, "dob" =3D> ####/##/##, "joined" =3D> =
####/##/##)
)
to address any given element
$datum =3D $passed_array[$row][$field];
so to get the third ssn in the set
$ssn =3D $passed_array[2]["ssn"];
Lathrop
Chris Hettinger wrote:
> As I loop through a result set I test each row, and for each row that =
passes, I need to record the information from 3 of the fields in the =
result set. Once I reach the end of my result set I need to look at the =
array of information, and count the number of records that had matched. =
Then I have a additional test I can run if I have more than one 1 row in =
my array. The goal is to find a 'single' match within a set of =
information that can in many cases have multiple results that can =
contain nearly exact information... Think, medical information where the =
only difference at times is the date on a policy, either it's active or =
not... or multiple policies for an individual...much of the information =
I have can be the same.
>=20
> To do this I believe I need to use a multi-dimensional array, but I am =
not sure how to go about implementing this. My knowledge of arrays is =
low, and the doc's I have read haven't cleared this up for me.
>=20
> For an example say the fields are
> 1) SSN
> 2) Birth date
> 3) Date Joined
>=20
> So say I have 3 records pass my tests I need to record
> =09
> ssn dob joined
> 111-11-1111 1990-03-05 2003-01-01
> 222-22-2222 1990-03-05 2001-03-07
> 333-33-3333 1990-03-05 1987-12-23
>=20
> When I count the array, I need to know I have 3 records.
>=20
> What I am hoping for here, is a example of how to create this array, =
and how to properly index it so I can count the rows properly.
>=20
>=20
>=20
> -Chris Hettinger, Web Specialist
> -IFMC/ENCOMPASS
> -www.encompas.com
> -(515) 279-8730
>=20
>=20
>=20
> CONFIDENTIALITY NOTICE: This communication, including any attachment, =
may contain confidential information and is intended only for the =
individual or entity to whom it is addressed. Any review, =
dissemination, or copying of this communication by anyone other than the =
intended recipient is strictly prohibited. If you are not the intended =
recipient, please contact the sender by reply email, delete and destroy =
all copies of the original message.'
>=20
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
_______________________________________________
ciapug mailing list
ciapug@cialug.org
http://cialug.org/mailman/listinfo/ciapug
CONFIDENTIALITY NOTICE: This communication, including any attachment, =
may contain confidential information and is intended only for the =
individual or entity to whom it is addressed. Any review, =
dissemination, or copying of this communication by anyone other than the =
intended recipient is strictly prohibited. If you are not the intended =
recipient, please contact the sender by reply email, delete and destroy =
all copies of the original message.'