
September 13th, 2004, 08:30 PM
|
 |
mod_dev_shed
|
|
Join Date: Sep 2002
Location: Atlanta, GA
|
|
|
With the PEAR route, you're creating an object from a class definition. You're then using the methods defined in that class to interact with the database. The advantages are plentiful.
If you use mysql_query() in your scripts, and you then want to take advantage of the new mysqli_query(), you'd have to go through all your scripts and make the change. Not a big deal with a couple of scripts; a huge deal with a couple hundred.
If you decide MySQL isn't working for you and you want to use something different, you can create a class with the same methods from your MySQL class, change your database, and that's it. No need to change mysql_query() to foo_query() in all your scripts.
In addition, database classes can provide debugging support, where each query sent through it is stored in the object along with the number of returned/affected rows or any errors that occurred. During debugging, you can then retrieve those messages/errors to help sort out problems.
__________________
# Jeremy
Explain your problem instead of asking how to do what you decided was the solution.
|