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
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';
class SimplePoll
{
var $DataBase;
var $ActivePoll;
$DBCls = &New clsDB; //Line 15, here is where the problem appear.
...
//------------------------
Thanks in advance for your time
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
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
$DBCls = &New clsDB();
but this is depricated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
should it be like this ?
$DBCls =$New clsDB;