26 mar 2009

Klasa do połączenia z baza danych mysql

class DB {
 private
  $host, $base, $user, $pass, $dbconn;

public function __construct DB($host, $base, $user, $pass) {
  $this->host = $host;
  $this->base = $base;
  $this->user = $user;
  $this->pass = $pass;
  $this->dbconn = mysql_connect($this->host, $this->user,$this->pass);
  mysql_select_db($this->base);
 }
}

$dbconn = new DB($host, $base, $user, $pass);
$result = mysql_query("SELECT * FROM content");