tyweed Posted May 28, 2008 Share Posted May 28, 2008 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 https://forums.phpfreaks.com/topic/107569-getting-error-on-host-but-not-on-my-local-machine-simple-scope-resolution-quest/ Share on other sites More sharing options...
roopurt18 Posted May 28, 2008 Share Posted May 28, 2008 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 https://forums.phpfreaks.com/topic/107569-getting-error-on-host-but-not-on-my-local-machine-simple-scope-resolution-quest/#findComment-551397 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.