Array Question

Array Question

am 17.08.2007 18:39:51 von Daniel Kaliel

------_=_NextPart_001_01C7E0ED.3D27C836
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have pull a bunch of data from an SQL database through a query. The =
problem I am running into is I pull two fields with the exact same name. =
How do I grab the right info? I have been using mydata ß the array =
name. mydata['contactID'] Should I instead use the array value so =
mydata[8]?


------_=_NextPart_001_01C7E0ED.3D27C836--

RE: Array Question

am 17.08.2007 18:59:53 von kvandegrift

Just use a column alias in your sql query and reference the alias in you=
r array.

SELECT t1.contactID as 'contactID_1', t2.contactID AS 'contactID_2'
FROM table1 t1, table2 t2 ...rest of query

Then your results data array can be referenced like so:
mydata['contactID_1']
mydata['contactID_2']

Ken Vandegrift
Shari's Management Corporation
Web Developer/Administrator
kvandegrift@sharis.com
-----Original Message-----
From: Daniel Kaliel [mailto:Daniel.Kaliel@jjbedmonton.com]=20
Sent: Friday, August 17, 2007 9:40 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Array Question

I have pull a bunch of data from an SQL database through a query. The=
problem I am running into is I pull two fields with the exact same name=
.. How do I grab the right info? I have been using mydata ß the array=
name. mydata['contactID'] Should I instead use the array value so myd=
ata[8]?

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php