Fatal error: Uncaught exception 'PDOException' with message 'could not find driv
-
Greetings,
I’ve installed WP DB Driver according to the provided instructions.
I’ve added
define( 'WPDB_DRIVER', 'pdo_mysql' );
to my wp-config.php.I’ve copied db.php to WordPress installation directory and wp-content/dp.php to the WordPress wp-content directory.
I have a functions.php in my child theme with the following function:
function twentytwelve_child_build_glossary(){ // Create PDO $dbh = new PDO(DB_HOST, DB_USER, DB_PASSWORD); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $strSQL = "SELECT term, definition FROM <code>wp_glossary</code> ORDER BY term"; try { // Prepare sql statement $stmt = $dbh->prepare($strSQL); $stmt->execute(); $result = $stmt->fetchAll(); } catch (Exception $e) { $result = "PDO Failed with Error: $e"; } return $result; }
I use an added shortcode to trigger the function, if that makes any difference.
I get the following error when attempting to use the function:
“Fatal error: Uncaught exception ‘PDOException’ with message ‘could not find driver’ in C:\xampp\htdocs\EOD\wp\wp-content\themes\twentytwelve-child\functions.php:15”Any idea what the issue might be.
Thanks!
- The topic ‘Fatal error: Uncaught exception 'PDOException' with message 'could not find driv’ is closed to new replies.