pdo to mysqli or mysql driver

can pdo connect to mysqli or mysql (soon to be depracated) driver
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yes, of course. Here you have the documentation needed.

And here a sample code:

$dbh = new PDO('mysql:host='.HOST.';dbname='.DATABASE,USERNAME,PASSWORD);
$sth = $dbh->query('SELECT id,name,email FROM users');
$user = $sth->fetch(PDO::FETCH_ASSOC);

Open in new window

And here is a nice tutorial for PDO to connect to your database.
Julian HansenCommented:
Not really a question.

PDO is a library for connecting to MySQL
MySQLi is a library for connecting to MySQL

They are different implementations of functionality to achieve the same end.

They are not interchangeable in the sense you can use a PDO object to invoke a MySQLi method.

They all can connect to the same MySQL server database - think of it as different roads to get to the same city.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
No, PDO requires the 'php_pdo' extension plus one of the other extensions like 'php_pdo_mysql'.  At least in the way you have to write the code, it does not appear to use the other driver directly.

Ray PaseurCommented:
This article should answer most of your questions.  MySQLi is an API for connecting to MySQL data bases.  PDO is a data-object API for connecting to many different kinds of data bases.  There is a bibliography at the end of the article if you want to learn more about these database extensions.

Please read it over and if you still are unsure about how the parts relate, please post back and I'll try to clarify.
rgb192Author Commented:

PDO is a library for connecting to MySQL
MySQLi is a library for connecting to MySQL
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.