- To: php-general@xxxxxxxxxxxxx
- Subject: PDO Prevent duplicate field names?
- From: Scott Baker <bakers@xxxxxxxxxxxx>
- Date: Mon, 02 Jul 2012 15:25:06 -0700
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0
$sql = "SELECT First, Last, Age, 'Foobar' AS Last;";
This is a simplified example of a SQL query where we're returning two
fields with the same name (Last). When I do a fetch_assoc with this
query I only get three fields, as the second "Last" field over writes
the first one.
I was hoping there was some method with PDO that would detect that and
throw a warning. Maybe some sort of "strict mode" that would tell me I'm
doing something stupid. Is there a way to catch this before it bites me?
It already bit me, but moving forward it'd be nice if PHP saw that
before I spent an hour debugging it again.
- Scott
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[PHP Home]
[Apache Users]
[PHP on Windows]
[Kernel Newbies]
[PHP Install]
[PHP Classes]
[Pear]
[Postgresql]
[Postgresql PHP]
[PHP on Windows]
[Find Someone]
[PHP Database Programming]
[PHP SOAP]