Link to home
Start Free TrialLog in
Avatar of GiantMatrix
GiantMatrix

asked on

PHP code problem

Hi All,

Whenever I try to check my PHP syntax below using my PHP Editor, I get the following error:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION on line 15


Where line 15 is the line (  $DBCls = &New clsDB; ) ...so can someone please tell me exactly what I am doing wrong here?


//----------------------------------------------------------
require_once '../include/db.class.php';   //This is the DB class (clsDB)...

class SimplePoll
{

    var $DataBase;
    var $ActivePoll;

    $DBCls = &New clsDB;  //Line 15, here is where the problem appear.

...

//----------------------------------------------------------



Thanks in advance for your time
Avatar of Emad Gawai
Emad Gawai
Flag of United Arab Emirates image

$DBCls = &New clsDB;

should it be like this ?

 $DBCls =$New clsDB;
Hmnn...
Why aren't we trying this?

--------------------------------------------------------------------------------------------
$DBCls=new clsDB();   //assuming that db.class.php has clsDB as class name.
--------------------------------------------------------------------------------------------


Did I miss anything here?

Regards
WC
if for some reason u want to assign $DBCls to the address of a new object, then

$DBCls = &New clsDB();

but this is depricated
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial