How to connect to external database using phpBB db classes

This is the simply way to connect to an external database in phpBB (we go to use mysql lib here, but you could use another of these available in /phpbb32/phpbb/db/driver folder changing namespace (if on php7> you need to use mysqli and NOT mysql or you’ll get error) using phpBB db classes

This is it.

Note: if on Php7 > change line

$phpbb_c = new \phpbb\db\driver\mysql();
into
$phpbb_c = new \phpbb\db\driver\mysqli();

to switch and use mysqli.

2 thoughts on “How to connect to external database using phpBB db classes”

    1. Hi there! It work fine if on phpBB32 with Php prior Php7
      If on php7, may just change line

      $phpbb_c = new \phpbb\db\driver\mysql();
      into
      $phpbb_c = new \phpbb\db\driver\mysqli();

      to switch and use mysqli and … all work fine
      [above edited] Cheers

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.