RE: Array Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just use a column alias in your sql query and reference the alias in your 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@xxxxxxxxxx
-----Original Message-----
From: Daniel Kaliel [mailto:Daniel.Kaliel@xxxxxxxxxxxxxxx] 
Sent: Friday, August 17, 2007 9:40 AM
To: php-windows@xxxxxxxxxxxxx
Subject:  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 mydata[8]?

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



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux