Thursday, February 9, 2012

What is the difference between using pear:DB to connect to a mysql db and using the php mysql functions .?

what is the advantage of using PEAR:DB over php mysql functions for database operations.
What is the difference between using pear:DB to connect to a mysql db and using the php mysql functions .?
The Pear::DB component is an object orientated approach to connecting to databases.



Any database not just MySQL.



For specifically connecting to MySQL, will probably not derive any great benefit.



However, if at some point in the future you decide to switch to PostGREs or DBase, or any of the 10 or so supported databases, using Pear::DB you would not need to re-write your code.



Additional benefits from using Pear::DB are that you can be sure that the DB interface is well written, documented and supported by unit tests, and will work on PHP4 and PHP5.
Reply:I used PEAR::DB on several Object Oriented projects. The main benefit for me is ease of use and flexibility.



See my answer to this question here for an example of how handy the class can be.



http://answers.yahoo.com/question/index;...
Reply:There's no real advantage either way... they're just two methods of doing the exact same thing.



Rawlyn.
Reply:no advantage.

No comments:

Post a Comment