Hi All,
For a project I'm working on I wanted to be able to add extra
functionality to Pear's DB class. I can add the functionality as
stand-alone functions, but as they were to do with the database
connection I thought it would make sense to wrap them up into a class
that extended the Pear::DB class.
So, I whipped this up to test:
require('DB.php');
class BobDB extends DB {
function myfunction($param) {
return true;
}
}
$bobdb = bobdb::connect('mysql://root@localhost/mydb');
return $bobdb->myfunction('hello');
PHP liked that in terms of syntax but the reference to myfunction
returned "Fatal error: Call to undefined function: myfunction()"
Now I know this problem is something to do with calling the PEAR::DB
class statically (using the :: operator) but I'm not sure how to get
around it.
I tried going down the $bobdb = new bobdb(); path but got lost with how
PEAR creates it's own instances of it's classes.
Any help appreciated.
Cheers,
- Bob -
--
Bob Brown, Web guru etc
http://www.guru.net.nz/