Re: Unexpected values in an associative array[Solved]
| From: | Robin Vickery | Date: | Tue, 31 Jul 2007 15:40:28 +0000 |
| Subject: | Re: Unexpected values in an associative array[Solved] | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259926@lists.php.net to get a copy of this message | ||
On 31/07/07, Ken Tozier <kentozier@comcast.net> wrote:
> Turns out that objects returned from SQL queries contain two parts
> for every field, one with a string key and one with an index key.
> Adding an "is_numeric" test on the keys allows you to filter out the
> numeric keys if you want to. For example:
Or don't get numeric keys in the first place:
foreach ($this->db->query($query, PDO::FETCH_ASSOC) as $row)
-robin