Jump to content

getting error on host but not on my local machine simple scope resolution quest?


tyweed

Recommended Posts

So i'm including a class DBInfo that has a few static variables that i'm using to connect to my database. This include is in the MysqlManager class. Then i'm using the scope resolution operator to access those static variables in DBInfo:

 

<?php

    include("DBManager.php");

    include("DBInfo.php"); <================ included here

 

 

class MysqlManager extends DBManager

{

    function MysqlManager()

    {

              $startTime = $this->getMicroTime();

 

 

              <============== see below this line my call to those static variables using scope resolution operator

              if (!$this->connection = @mysql_connect(DBInfo::$host,DBInfo::$user,DBInfo::$pass,true)){

                  $this->errorCode = mysql_errno();

 

 

 

DBInfo looks like:

 

 

class DBInfo

{

static $host = 'localhost';

static $user = 'root';

static $pass = '';

static $db = 'bets';

 

}

 

 

So on my local i'm using php5 and i gert no errors. On my host its php4 and i'm gettiong this error and i have no idea why?

 

Parse error: parse error, unexpected ',', expecting '(' in /www/vo/youbetyourass/MysqlManager.php on line 13

As far as I can tell it should work, so when all else fails, comment out the broken code and echo a single value.

 

<?php
     include("DBManager.php");
     include("DBInfo.php");


class MysqlManager extends DBManager
{
     function MysqlManager()
     {
               $startTime = $this->getMicroTime();

               echo 'DBInfo::$host: ' . DBInfor::$host . '<br />';
               /*
               if (!$this->connection = @mysql_connect(DBInfo::$host,DBInfo::$user,DBInfo::$pass,true)){
                   $this->errorCode = mysql_errno();
               }
               */

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.