Re: PDO Prevent duplicate field names?

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

 



On 07/02/2012 03:34 PM, Matijn Woudt wrote:
> Why the #### would you want to return 2 columns with the same name?
> To be short, there's no such function, so you have to:
> 1) Rename one of the columns
> 2) or, use fetch_row with numerical indexes instead of fetch_assoc.

My "real world" scenario was this

SELECT a.CustID, b.*
FROM Customer a
LEFT JOIN Sales B USING (CustID)
WHERE a.CustID = 1234;

In that case, there was a record in Customer, but not in Sales. Sales
returned CustID as NULL, which overwrote the one from Customer.

It was my mistake, and the SQL was easily fixed. But it woulda been nice
to have PHP realize there was a dupe when it was building that array to
return to me.


-- 
Scott Baker - Canby Telcom
System Administrator - RHCE - 503.266.8253



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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux