Is there some way of building a PHP application that can either connect to a MySQL or Oracle DB without having to change DB connection and query functions if the database changes to/from MySQL/Oracle?
My initial thoughts are 'no'. Surely a PHP DB connection needs to be different for different DB types. However, there might be some function haven't heard about that attempts to connect to a DB in different ways.
Any thoughts would be great. I have a PHP application that connects to a MySQL database on my machine but due to company policy, they only offer Oracle DBs so I'm going to have to change things.
Thank you.
Yes. It's called a Database Abstraction Layer. Have a look at PDO, it comes bundled with PHP.
Use PDO. You need to ensure that your queries work in both database systems though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With