Re: how to assign a value to a variable inside a class
| From: | Merlin | Date: | Tue, 11 Apr 2006 09:46:47 +0000 |
| Subject: | Re: how to assign a value to a variable inside a class | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233751@lists.php.net to get a copy of this message | ||
chris smith schrieb:
On 4/11/06, Merlin <news.groups@web.de> wrote:The following code:Hi there, no much simpler. I do not need to assign the value from outside the class. This is just inside the class. I have the login data for a database saved in a file and would like to use simply the variable $DB_login inside this class. This does not work: $this->db_username = $DB_login;That's the right way to do it. What are you seeing? -- Postgresql & php tutorials http://www.designmagick.com/
class search_helper extends AjaxACApplication
{
var $db_username;
$this->db_username = $DB_LOGIN;
...does bring following error message:
Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in file.inc on line 39
Line 39 is the one with $this
Any suggestions?