Using MDB2 and MySQLi together (Good or bad?)

1.3k views Asked by At

I want to use the PEAR Mail_queue package which requires the PEAR MDB2 package for database abstraction.

I currently use MySQLi for all my database queries and dont really desire using MDB2.

Would it be bad practice to use both MDB2 and MySQLi in my PHP applications at the same time?

Can anyone give me a good reason to use MDB2 over MySQLi all together?

Thanks.

2

There are 2 answers

0
Percutio On

PEAR::MDB2 has a driver that uses mysqli, so I don't get the point of your question. If your asking:

It is good or bad to have one connection opened with mysqli_* and another opened with PEAR::MDB2

then it's not bad, but you may be opening two connections to the same database while only one could be necessary. Be aware that if you start mixing both connections in your code, you can get confused quickly when it comes to maintenance.

0
kguest On

There are no known issues with using MDB2 and any other method of connecting to a mysql database concurrently. You should be fine.

It's good practice to use MDB2 or any other abstraction layer so you can later migrate to using a different type of database server (postgresql or sqlite for example) with a minimum of fuss.