pdo to mysqli or mysql driver

can pdo connect to mysqli or mysql (soon to be depracated) driver
LVL 1
rgb192Asked:
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.

ArgentiCommented:
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.
0
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.
0

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.

http://us2.php.net/manual/en/ref.pdo-mysql.php
0
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.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_11177-PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html

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

PDO is a library for connecting to MySQL
MySQLi is a library for connecting to MySQL
0
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
PHP

From novice to tech pro — start learning today.