Sunday, December 17, 2006

phpBB forum - using the default DB object

Have been doing a little freelance lately, mainly involving integrating new functionality with phpBB.
Using the existing code speeds up development and minimizes redundant code. Below is the code needed to use the default database object in phpBB.

[php]
define('IN_PHPBB', true);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$sql = "SELECT * FROM " . A_TABLE . "
WHERE rank_special = 1
ORDER BY a_title";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR,
'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);

}
else echo "Query successsful";

No comments:

Post a Comment