Must I use PDOStatement->setFetchMode () before each fetching data if I
want to get only or usually ASSOC arrays? Perhaps, not.
foreach( $stmt as $array ) { ... }
It's the fastest way for fetching records to $array from result. So I
have to insert $stmt -setFetchMode(PD O::FETCH_ASSOC) before each
Foreach.
Simply - lack of PDO->defaultFetchMo de(). No one thought about it
creating PDO. Who can tell PHP or PDO developers about it?
Or:
PDO->setAttribute(P DO::FETCH, PDO::FETCH_ASSO C);
Why does PDO have constants instead of parameters? Typing PDO::[...]
isn't so comfortable and I wonder if it isn't slower.
want to get only or usually ASSOC arrays? Perhaps, not.
foreach( $stmt as $array ) { ... }
It's the fastest way for fetching records to $array from result. So I
have to insert $stmt -setFetchMode(PD O::FETCH_ASSOC) before each
Foreach.
Simply - lack of PDO->defaultFetchMo de(). No one thought about it
creating PDO. Who can tell PHP or PDO developers about it?
Or:
PDO->setAttribute(P DO::FETCH, PDO::FETCH_ASSO C);
Why does PDO have constants instead of parameters? Typing PDO::[...]
isn't so comfortable and I wonder if it isn't slower.
Comment