Re: Troubles with Classes
| From: | lallous | Date: | Wed, 14 Aug 2002 09:19:21 +0000 |
| Subject: | Re: Troubles with Classes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112495@lists.php.net to get a copy of this message | ||
try to put any code inside the new class' constructor part,
-> move the this code:
> $DBQuery = new DBQueries; <--------------------------- this
> is line 134
> $DBQuery->attrib["type"] = "select";
> $DBQuery->attrib["query"] = "SELECT ID_Secpage, PageType,
into :
class SubMenu {
SubMenu()
{
$this->DBQuery->attrib["type"] = "select";
$this->DBQuery->attrib["query"] = "SELECT ID_Secpage,
PageType,
}
}
Elias
"Jadiel Flores" <jflores@abargon.com> wrote in message
news:5.1.0.14.2.20020813151614.0296ae98@mail.abargon.com...
> Hey guys, I have a little problem here, I have one class to create queries
> to a mysql database, this class works fine, but, now I want to create an
> instance of this class inside another class but I'm receiving the error:
>
> Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION
> or T_FUNCTION or T_VAR or '}' in
> D:\InetPub\hispanicroot\includes\database.php on line 134
>
> This is my code:
>
> class SubMenu {
> var $attrib = array("level"=>"",
> "page"=>"", "section"=>"");
> $DBQuery = new DBQueries; <--------------------------- this
> is line 134
> $DBQuery->attrib["type"] = "select";
> $DBQuery->attrib["query"] = "SELECT ID_Secpage, PageType,
> Title, PageURL FROM inf_secpages WHERE ID_Page = " . $attrib['page'] . "
> ORDER BY Slot ASC";
> $GetData = $DBQuery->RunQuery();
> bla bla bla ..........
> }
>
> If I use:
> var $DBQuery = new DBQueries;
> then I receive the error:
> Parse error: parse error, unexpected T_NEW in
> D:\InetPub\hispanicroot\includes\database.php on line 134
>
> Thanks
>
>
> Jadiel Flores
> -------------------------
> http://www.abargon.com
> jflores@abargon.com
> (52-55) 52-29-80-34
>
>