List of Avaiable PDO Drivers for your site

Posted By: Ian on Dec 17, 2012 in PDO, PHP, Snippets
Last modified on March 1st, 2014 at 10:26 pm,

PDO (PHP Data Objects) extension for PHP seems to be the way to go for connecting to and accessing databases such as MySQL and with this little snippet you can easily see what PDO drivers are available for your site if any.

<?php
foreach (PDO::getAvailableDrivers() as $driver) {
if ($driver == NULL) {
echo "No PDO drivers were found!";
} else {
echo $driver."<br />";
}
}
?>

 
PDO comes with PHP 5.1 and above as default.
 
See http://us1.php.net/manual/en/pdo.getavailabledrivers.php for more details and for everything to do with PDO see
http://us1.php.net/manual/en/book.pdo.php
 

AnonymousIan.J.Gough

Did this help you? Please Let me know by commenting below even if it’s just to say “Thanks”

leave a comment

About This Site

Dreams are built from lines of code well it's true!
If you can dream it you can usually code it.

I have learned so much from other people on the Internet and this site is for me to give back some of what i have learned and hope people can now learn from me.
Have fun and surf safely,
Ian.J.Gough

protected by copyscape duplicate content check

Categories


Powered by Banner Bar 125