Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

41 users online



OOP in PHP 4.4.2 vs 4.4.4

OOP in PHP 4.4.2 vs 4.4.4

Currently viewing this thread: 1 (0 members and 1 guests)


howdy

howdy

Neverside Newbie
Status: Offline!

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;
        }
    }

___________________

Haudenschilt.com

icorey

icorey

Neverside Newbie
Status: Offline!

$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

The above code should work. I've done a lot with OOP, but only a little with OOP in PHP, so I can't guarantee anything.

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0083 seconds.