OOP in PHP 4.4.2 vs 4.4.4
I am trying to re-write an old message board script I wrote awhile ago, using object oriented programming.
The problem is I keep getting errors on one server A using php 4.4.2 and it works fine on server B using php 4.4.4.
Anyone know what's wrong with my code and how/where I can find out how to fix it.
PHP Notice: Undefined variable: db in .../httpdocs/inc/messageboard.class.php on line 11
PHP Notice: Undefined variable: db in .../httpdocs/inc/messageboard.class.php on line 12
PHP Notice: Undefined variable: db in .../httpdocs/inc/messageboard.class.php on line 13
PHP Notice: Undefined variable: db in .../httpdocs/inc/messageboard.class.php on line 14
PHP:<?php
include 'database.class.php';
class MessageBoard {
var $db;
var $tz_offset;
var $cur_user_id;
function MessageBoard ($current_user_id, $type, $host, $database, $user, $pass) {
$this->$db = new database($type, $host, $database, $user, $pass); // line 11
$this->$db->debug_mode(); // line 12
$this->$db->query("SELECT timezone FROM fcms_users WHERE id = $current_user_id"); // line 13
$row = $this->$db->get_row(); // line 14
switch($row['timezone']) {
case 'EDT': $this->$tz_offset = '-4 hours'; break;
case 'CDT': $this->$tz_offset = '-5 hours'; break;
case 'MDT': $this->$tz_offset = '-6 hours'; break;
case 'PDT': $this->$tz_offset = '-7 hours'; break;
case 'AKDT': $this->$tz_offset = '-8 hours'; break;
case 'HST': $this->$tz_offset = '-9 hours'; break;
default: $this->$tz_offset = '-4 hours'; break;
}
}
___________________
