Help with mysql_select_db()

Can someone help me understand this?


<?php
// Location: framework/classes/database.class.php

class database {
  // Variables
  private $variables;
  
  // Functions
  function database() {
    $this->variables['type'] = "mysql";
    $this->variables['server'] = "localhost";
    $this->variables['username'] = "<username>";
    $this->variables['password'] = "<password>";
    $this->variables['database'] = "<database>";
    
    switch ($this->variables['type']) {
      case "mysql":
        if ($this->variables['connection'] = mysql_connect($this->variables['server'], $this->variables['username'], $this->variables['password']) !== false) {
          framework_log('Connected to ' . $this->variables['type'] . ' server: \'' . $this->variables['server'] . '\'');
          if ($this->variables['connection_db'] = mysql_select_db($this->variables['database'], $this->variables['connection']) !== false) {
            framework_log('Connected to ' . $this->variables['type'] . ' database: (' . $this->variables['database'] . ')');
          }
          else {
            framework_log('Failed connecting to ' . $this->variables['type'] . ' database: \'' . $this->variables['database'] . '\'', true);
          }
        }
        else {
          framework_log('Failed connecting to ' . $this->variables['type'] . ' server: (' . $this->variables['server'] . ')', true);
        }
      break;
      default:
        return false;
      break;
    }
  }
  function query($sql) {
    switch ($this->variables['type']) {
      case "mysql":
        if ($query = mysql_query($sql, $this->variables['connection']) or die('Class: database - Unable to perform query') !== false) {
          framework_log('Executed ' . $this->variables['type'] . ' query: (' . $sql . ')');
          return $query;
        }
        else {
          framework_log('Failed executing ' . $this->variables['type'] . ' query: \'' . $sql . '\'', true);
        }
      break;
      default:
        return false;
      break;
    }
  }
}
$framework['classes']['database'] = new database();

?>

I get this error:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /Users/matt/Sites/www/projects/2c26b783b4568e384a1fbe3f06ac7566/trunk/framework/classes/database.class.php on line 20