I have the following PHP code:
$TBL_PREFIX="tbl_calendar";
$OTHERTBL_PREFIX="tbl_calendar_other";
class Editor{
var $TBL;
var $OTHERTBL;
function Editor(){
global $TBL_PREFIX;
global $OTHERTBL_PREFIX;
$this->$TBL=$TBL_PREFIX;
$this->$OTHERTBL=$OTHERTBL_PREFIX;
}
function getIncomingEventList(){
$sql="select e.id,e.event_name,e.date_created from ".$this->$TBL."event e
join ".$this->$TBL."status s on e.status_id=s.id where e.status_id=1";
$rs=mysql_query($sql) or Error::handleQueryError($sql);
return $this->toArray($rs);
}
}
Here's what's weird: debugging shows that in function getIncomingEventList, $this->$TBL has a value equivilent to $OTHERTBL_PREFIX. If I delete or comment out the line $this->$OTHERTBL=$OTHERTBL_PREFIX, $this->$TBL asssumes the value of $TBL_PREFIX.
Why is that happening and what can I do to fix it? I have PHP4 with Apache2.