Hiya,

Ive just started trying to play around with OOP a little bit and wondered if someone could help me with this. Here are the 3 bits of code I am using. I dont get any errors but nothing is inserted into the database. I am fairly sure its something simple, just dont know what.

Stats.class.php

PHP Code:

include("dao.class.php");

class 
statTracker {

    var 
$mysql;
    var 
$conn;

    function 
runTracker($ip$browser) {
    
        
$this->mysql = &new MySQL();
        
$this->conn $this->mysql->connectToDb();
        
$sql =  "INSERT INTO
                    stat
                 SET
                    ip = '
$ip',
                    browser = '
$browser',
                    date = NOW()"
;
        
$this->mysql->query($sql);
    }

dao.class.php

PHP Code:

class MySQL {

    var 
$dbHost;
    var 
$dbUser;
    var 
$dbPass;
    var 
$dbName;
    var 
$dbConn;
    var 
$dbSel;
    var 
$dbConnError;
    var 
$dbSelError;
    
    function 
MySQL(){
    
        
$this->dbHost 'localhost';
        
$this->dbUser '';
        
$this->dbPass '';
        
$this->dbName 'mark';

    }
    
    function 
connectToDb(){
    
        
$this->dbConn mysql_connect($this->dbHost$this->dbUser$this->dbPass);
        if(!
$this->dbConn) {
            
$this->dbConnError "Error connecting to database";
            return 
$this->dbConnError;
        }
        if(
$this->dbConn) {
            
$this->dbSel mysql_select_db($this->dbName);
        }
        if(!
$this->dbSel) {
            
$this->dbSelError ="Error selecting the database";
            return 
$this->dbSelError;
        }
    }

    function &
query($sql) {
    
        return new 
fetch($this, @$result);
        
    }
}

class 
fetch {

    var 
$connectToDb;
    var 
$query;
    
    function 
fetch($connectToDb$query) {
    
        
$this->connection = &$connectToDb;
        
$this->query $query;

    }

    function 
fetchFromDb() {

        
$row mysql_fetch_array($this->queryMYSQL_ASSOC);
        return 
$row;

    }

add.php

PHP Code:

include("stats.class.php");

$track = &new statTracker();

$ip $_SERVER['REMOTE_ADDR'];
$browser $_SERVER['HTTP_USER_AGENT'];

$track->runTracker($ip$browser);