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

Link to comment
Share on other sites

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();
               }
               */

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.