<p>I am using my own db for phpbb3 forum, and I wish to insert some data from the forum into my own tables. Now, I can make my own connection and it runs my query but in trying to use the $db variable(which I think is what you're meant to use??) it gives me an error.</p>

<p>I would like someone to show me the bare bones which i insert my query into to be able to run it.</p>

Well.. You haven't given us very much information, but there are two things you need to do to connect and query to a database.
For phpbb, you may want to read the documentation they have presented:
http://wiki.phpbb.com/Database_Abstraction_Layer
Here is a general overview of how you'd execute a query:
```
```
include($phpbb_root_path . 'includes/db/mysql.' . $phpEx);

$db = new dbal_mysql();
// we're using bertie and bertiezilla as our example user credentials. You need to fill in your own ;D
$db->sql_connect('localhost', 'bertie', 'bertiezilla', 'phpbb', '', false, false);

$sql = "INSERT INTO (rest of sql statement)";

$result = $db->sql_query($sql);
```
```