News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Cyberlot's Blog:
Extending PDO and PDO FETCH_ASSOC
December 19, 2005 @ 06:53:18

On Cyberlot's blog today, he has this new post where he looks at extending the already powerful PDO library to fetch information and not have to use setFetchMode with every query.

One thing with pdo, every time you do a statement you have to tell if what mod to use for fetch. You can do this either directly by passing a value like PDO::FETCH_ASSOC to your fetch statements or to setFetchMode for each query result.

Now if your like me and use the same exact mode 99% of the time this can get a little annoying.

Well ran into a project where I would need to get the status of a mysql table often, so wanted to make some reusable code for this, realize this also might be a good time to tackle the whole pdo issue, so here you go a solid example of how to extend PDO to stop having to use setFetchMode every query or extend it some more to change your needs.

The code itself is pretty simple, and makes fetching the results a bit less tedius of a task...

0 comments voice your opinion now!
extening PDO fetch_assoc setFetchMode extening PDO fetch_assoc setFetchMode


blog comments powered by Disqus

Similar Posts

Ilia Alshanetsky\'s Blog: php|tek Slides Posted

Marco Tabini's Blog: 5 PHP 5 features you can't afford to ignore

David Coallier's Blog: Zend_Db Without PDO part #3 (SVN Repository)?

Gonzalo Ayuso's Blog: How to protect from SQL Injection with PHP

Kian Hui Teo\'s Blog: Switching between PHP 5.1.x and Zend Core for Oracle


Community Events











Don't see your event here?
Let us know!


language unittest package database install composer performance example facebook security release component symfony2 podcast introduction hhvm project framework hack application

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework