tags:

views:

522

answers:

4

Can anyone recommend a good wrapper class or extension to PHP's mysqli extension that allows the equivalent of

mysql->fetch_assoc()

for a prepared statement. That is ideally it condenses down into a single statement the tedious complexity of the init/prepare/bind/fetch-loop.

A: 

Zend_DB is a great wrapper for database functions including mysqli.

It has options to retrieve table data as associative arrays, or as objects if you desire. It also includes support for prepared statements.

You don't have to use the entire zend framework to use Zend_DB, you can use it on its own.

Kekoa
+1  A: 

Write a class that extends mysqli and adds that functionality!!!!

Here's a start

http://us.php.net/manual/en/mysqli-stmt.fetch.php#72720

Galen
Yes of course - I was just thinking that this is *such* an obvious thing to do that there had to be code out there already so save myself re-inventing the wheel
Cruachan
A: 

try dalmp.com code.dalmp.com currently on beta but maybe you can help to test it

nbari
A: 

It's actually really easy to write wrappers for or extend PDO.

$this->setAttribute(self::ATTR_STATEMENT_CLASS, array('yourClassName', array($this)));

Something like that will let you specify a class to replace PDOStatement.

whichdan