Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread Merlin
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;

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread chris smith
On 4/11/06, Merlin [EMAIL PROTECTED] wrote: 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

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread Merlin
chris smith schrieb: On 4/11/06, Merlin [EMAIL PROTECTED] wrote: 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

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread chris smith
On 4/11/06, Merlin [EMAIL PROTECTED] wrote: chris smith schrieb: On 4/11/06, Merlin [EMAIL PROTECTED] wrote: 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

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread Merlin
chris smith schrieb: On 4/11/06, Merlin [EMAIL PROTECTED] wrote: chris smith schrieb: On 4/11/06, Merlin [EMAIL PROTECTED] wrote: 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

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread Brad Bonkoski
Merlin wrote: chris smith schrieb: On 4/11/06, Merlin [EMAIL PROTECTED] wrote: chris smith schrieb: On 4/11/06, Merlin [EMAIL PROTECTED] wrote: 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

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread Jarratt Ingram
If you are using PHP4, you could always class foo { var $var1; var $var2; var $var3; function bar(){ echo $this-var1.br /; echo $this-var2.br /; echo $this-var3.br /; } } then in your code $foo = new foo(); $foo-var1 = 'blah'; $foo-var2 = 'blah'; $foo-var3 = 'blah'; $foo-bar();

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread Richard Lynch
On Tue, April 11, 2006 3:14 am, Merlin wrote: This does not work: $this-db_username = $DB_login; Any idas on how to do this? Since how you do this is how you did it, you're going to have to show us the exact code you did that does not work because what you typed above DOES WORK... -- Like

Re: [PHP] how to assign a value to a variable inside a class

2006-04-11 Thread Richard Lynch
On Tue, April 11, 2006 6:40 am, Merlin wrote: The following code: class search_helper extends AjaxACApplication { var $db_username; $this-db_username = $DB_LOGIN; A 'var' is a 'property' of a Class instance. It needs to be inside the class, but not inside a

[PHP] how to assign a value to a variable inside a class

2006-04-10 Thread Merlin
Hi there, I would like to assign a value inside a class like this: var $db_username = $old_name; Unfortunatelly this does not work and I do get following error: Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' Thank you for any hint

Re: [PHP] how to assign a value to a variable inside a class

2006-04-10 Thread Brad Bonkoski
How about this: class foo { var $name; function setName($value) { $this-name = $value; } } -B Merlin wrote: Hi there, I would like to assign a value inside a class like this: var $db_username = $old_name; Unfortunatelly this does not work and I do get following error:

Re: [PHP] how to assign a value to a variable inside a class

2006-04-10 Thread Dave Goodchild
use a setter function. Direct var assignments must be simple constants. A setter function enforces encapsulation. On 10/04/06, Merlin [EMAIL PROTECTED] wrote: Hi there, I would like to assign a value inside a class like this: var $db_username = $old_name; Unfortunatelly this does not