Title: gyclone's Replies | WordPress.org

---

# gyclone

  [  ](https://wordpress.org/support/users/gyclone/)

 *   [Profile](https://wordpress.org/support/users/gyclone/)
 *   [Topics Started](https://wordpress.org/support/users/gyclone/topics/)
 *   [Replies Created](https://wordpress.org/support/users/gyclone/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/gyclone/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/gyclone/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/gyclone/engagements/)
 *   [Favorites](https://wordpress.org/support/users/gyclone/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP DB Driver] Fatal error: Uncaught exception 'PDOException' with message 'could not find driv](https://wordpress.org/support/topic/fatal-error-uncaught-exception-pdoexception-with-message-could-not-find-driv/)
 *  Thread Starter [gyclone](https://wordpress.org/support/users/gyclone/)
 * (@gyclone)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-exception-pdoexception-with-message-could-not-find-driv/#post-5212183)
 * Thank you for your response! I was unaware of WPDB at the time I posted this.
   I was trying to use a function I wrote for another program on a custom page and
   was getting a missing PDO driver error. I knew I had the PDO driver installed
   in my database because I use PDO all the time. It was late and I wasn’t thinking
   clearly and as a result, I wrongly assumed that my error was a result of WordPress
   not supporting PDO. I downloaded your plugin in hopes that it would solve my 
   problem. It did not and I wrongly assumed I had failed to install the plugin 
   properly. In fact, I had just made some silly errors in my code. Coincidentally,
   I stumbled upon WPDB the next morning and redid my function accordingly. Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP DB Driver] Fatal error: Uncaught exception 'PDOException' with message 'could not find driv](https://wordpress.org/support/topic/fatal-error-uncaught-exception-pdoexception-with-message-could-not-find-driv/)
 *  Thread Starter [gyclone](https://wordpress.org/support/users/gyclone/)
 * (@gyclone)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/fatal-error-uncaught-exception-pdoexception-with-message-could-not-find-driv/#post-5211894)
 * Turns out I don’t even need the plugin to accomplish my goal. I thought it was
   required in order to use PDO from within WordPress, but apparently that is not
   the case.
 * In case anyone stumbles on this, my revised function (below) works without using
   any plugins.
 * `function twentytwelve_child_build_glossary(){
 *  $dbhost = DB_HOST;
    $dbname = DB_NAME;
 *  // Create PDO
    $dbh->_pdo = new PDO(“mysql:host=$dbhost, dbname=$dbname”, DB_USER,
   DB_PASSWORD); $dbh->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $strSQL = “SELECT term, definition FROM $dbname.wp_glossary ORDER BY term”;
 *  try {
    // Prepare sql statement $stmt = $dbh->_pdo->prepare($strSQL); $stmt-
   >execute(); $result = $stmt->fetchAll(); } catch (Exception $e) { $result = “
   PDO Failed with Error: $e”; }
 *  return $result;
    }
 * Sorry if I’ve wasted anyone’s time. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)