Something along the lines of the following should (untested) work:
PHP Code:
// The database class
class Blizz
{
// The database link pointer
var $link = 0;
// The constructor - connect to the sql server and select the database
function Blizz($dbhost, $dbuser, $dbpass, $dbname)
{
$this->link = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $this->link);
}
// Query the database
function query($query)
{
$result = mysql_query($query, $this->link);
return $result;
}
}
// The code that you would use in your app
$db = new Blizz($dbhost, $dbuser, $dbpass, $dbname);
$result = $db->query("SELECT ... whatever ...");
You should probably add some sort of error checking / handling in there