As said before I think your problem is the $db variable
You define $db as a global variable in this module. the code looks like its expecting $db to be some form of class, I'd guess its going to be an abstraction class for db interaction.
at no point between the declaration of the variable do you instantiate the class variable set it up with parameters that define what database to use, what user id and what password
if you look at the link you provided you at least those
PHP Code:
$db = new $sql_db();
// 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);
however you aslo need to tell the php interpreter what $db is. from your reference it looks like its a class and the name of the class file to use is mysql in the includes/db/ directory of your PHP server.
either you need to go to a PHPBB forum to get support on this or you need to work out how to merge your code with the existing PHPBB.
I'd suggest you check to see if the variable $db is initialised elsewhere as a global. if so then it will already have your connection details. to find out comment out the global $db line and re run the script
if its not defined elsehwere then you need to initialise the class
include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
$db = new $sql_db();
// 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);
where the values for localhost, bertie etc are as described in the reference you gave and should be available to you from your ISP or whoever set up the account
you will need the
the server name OR IP address of the My_SQL server
the name of the database for your system
userid and password for the account
if you know the server name, database name, userid and password then you could create your own database connection for now.. just to get it working
$cnn=@mysql_connect(<ipaddressofhost>,<userid>,<pa ssword) or die("Failed to open connection ".mysql_errno().": ".mysql_error()));
$dbr=@mysql_select_db($dbn,$cnn) or die ("Failed to open db:".mysql_errno().": ".mysql_error()));
$sql = "<my sql statement>";
$sqlr=@mysql_query($sql,$cnn) or die ("Failed to open rs:$sql ".mysql_errno().": ".mysql_error()));
if mysql_num_rows($sqlr) > 0
{ //insert code here if we have found rows in the db
} else
{ //insert code here if we haven't
}