Re: how to assign a value to a variable inside a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/11/06, Merlin <news.groups@xxxxxx> wrote:
> chris smith schrieb:
> > On 4/11/06, Merlin <news.groups@xxxxxx> 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 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/
>
> The following code:
>      class search_helper extends AjaxACApplication
>      {
>         var $db_username;
>         $this->db_username      = $DB_LOGIN;

Try it like this:

class search_helper extends AjaxACApplication
{
  var $db_username;
...

function SetDBUsername($db_username) {
  $this->db_username = $db_username;
}


If you want to set a default:

var $db_username = 'xxxxxxxx';

--
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux