Posted by webcm123 on 06/17/07 16:39
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(PDO::FETCH_ASSOC) before each
Foreach.
Simply - lack of PDO->defaultFetchMode(). No one thought about it
creating PDO. Who can tell PHP or PDO developers about it?
Or:
PDO->setAttribute(PDO::FETCH, PDO::FETCH_ASSOC);
Why does PDO have constants instead of parameters? Typing PDO::[...]
isn't so comfortable and I wonder if it isn't slower.
Navigation:
[Reply to this message]
|