Re: [PHP] Unexpected values in an associative array

2007-08-07 Thread Ken Tozier
On Aug 8, 2007, at 12:43 AM, Robert Cummings wrote: On Tue, 2007-08-07 at 23:28 -0500, Richard Lynch wrote: On Tue, July 31, 2007 11:06 am, Instruct ICC wrote: What is $value and what is this supposed to do: case'integer':

RE: [PHP] Unexpected values in an associative array

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 23:28 -0500, Richard Lynch wrote: > On Tue, July 31, 2007 11:06 am, Instruct ICC wrote: > > What is $value and what is this supposed to do: > >>case'integer': > >>

RE: [PHP] Unexpected values in an associative array

2007-08-07 Thread Richard Lynch
On Tue, July 31, 2007 11:06 am, Instruct ICC wrote: > What is $value and what is this supposed to do: >> case'integer': >> $value >> += 0; >> This is a silly hack

Re: [PHP] Unexpected values in an associative array

2007-08-01 Thread Travis D
On 7/31/07, Ken Tozier <[EMAIL PROTECTED]> wrote: > > ... > // set fetch prefs > $this->db->setAttribute(PDO:: FETCH_ASSOC, > true); // also tried 1 > ... > Is that the way to do it? Hmm.. Maybe I sent you in the wrong direction - I can't find any doc

Re: [PHP] Unexpected values in an associative array

2007-07-31 Thread Ken Tozier
On Jul 31, 2007, at 12:06 PM, Instruct ICC wrote: array(6) { ["task_id"]=> int(22) [0]=> string(2) "22" ["container_id"]=> int(3784) [1]=> string(4) "3784" ["name"]=> string(12) "108-6972.XTG" [2]=> string(24) "3130382D363937322E585447" } What is $coersions or $inQuery[

Re: [PHP] Unexpected values in an associative array[Solved]

2007-07-31 Thread Robert Cummings
On Tue, 2007-07-31 at 11:29 -0400, Ken Tozier 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. F

RE: [PHP] Unexpected values in an associative array

2007-07-31 Thread Instruct ICC
From: Ken Tozier <[EMAIL PROTECTED]> Hi I think this is probably just a misunderstanding on my part, but I'm creating associative arrays with string keys from MySQL query results and when I put a value in the array, I get the expected key association along with an index key that has a diffe

Re: [PHP] Unexpected values in an associative array[Solved]

2007-07-31 Thread Ken Tozier
On Jul 31, 2007, at 11:40 AM, Robin Vickery wrote: Or don't get numeric keys in the first place: foreach ($this->db->query($query, PDO::FETCH_ASSOC) as $row) Robin: Bingo! That did the trick. I knew my solution was hokey but I haven't used PDO before this project so wasn't aware of what i

Re: [PHP] Unexpected values in an associative array[Solved]

2007-07-31 Thread Zoltán Németh
2007. 07. 31, kedd keltezéssel 11.29-kor Ken Tozier ezt írta: > 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 w

Re: [PHP] Unexpected values in an associative array[Solved]

2007-07-31 Thread Robin Vickery
On 31/07/07, Ken Tozier <[EMAIL PROTECTED]> 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 examp

Re: [PHP] Unexpected values in an associative array

2007-07-31 Thread Jim Lucas
Ken Tozier wrote: foreach ($this->db->query($query) as $row) Well, this is what I was going to say, is that probably query is using *_fetch_array() instead of *_fetch_assoc() or *_fetch_row() -- Jim Lucas "Some men are born to greatness, some achieve greatness, and so

Re: [PHP] Unexpected values in an associative array[Solved]

2007-07-31 Thread Ken Tozier
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: foreach ($row as $key => $value) { if (