Re: Need help transitioning from Pear DB to Pear MDB2

From: Date: Tue, 10 Feb 2009 01:54:22 +0000
Subject: Re: Need help transitioning from Pear DB to Pear MDB2
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29687@lists.php.net to get a copy of this message
Tom Parkison wrote:
I have two web sites that I maintain that I developed around Pear DB starting a long time ago. I've run into a issue, Pear DB isn't being maintained anymore. The problem I'm running into is that I use a lot calls to a function that looks like this... $query->numRows(); and it seems that Pear MDB2 doesn't support it.
Is $query the result object? (it's been a long time since I used DB) If so, you're in luck. You just need to load the Extended module after creating the connection. Also, make sure that result_buffering is true (this bit me once). $options = array(
    'result_buffering' => true
); $mdb2 = MDB2::connect($dsn, $options); or, if using PHP4 $mdb2 =& MDB2::connect($dsn, $options); then: $mdb2->loadModule('Extended'); $mdb2->setFetchMode (MDB2_FETCHMODE_ASSOC); etc. If your connections are all made from one file that's included into your scripts this should be a simple fix.

« previous php.pear.general (#29687) next »