Re: [PHP] Retrieving values from array on a class

2006-10-16 Thread Stut
Richard Lynch wrote: But I don't think you can even *DO* an include() inside a class definition, so that should be giving you an error... You can do an include/require anywhere. However, you cannot declare new functions inside an include and use it to add methods or variables to a class. --

Re: [PHP] Retrieving values from array on a class

2006-10-16 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-16 12:47:47 -0500: > On Sat, October 14, 2006 5:18 pm, Kevin Waterson wrote: > >>>class returnConfigParams > >>> { > >>> > >>> var $a; > > >>> function getMySQLParams() > >>> { > >>>include($_SERVER['DOCUMENT_ROOT']."/properties.php"); > >>> > >>>$values =

Re: [PHP] Retrieving values from array on a class

2006-10-16 Thread Richard Lynch
On Sat, October 14, 2006 5:18 pm, Kevin Waterson wrote: >>>class returnConfigParams >>> { >>> >>> var $a; >>> function getMySQLParams() >>> { >>>include($_SERVER['DOCUMENT_ROOT']."/properties.php"); >>> >>>$values = array(0 => $a, 1 => $b, 2 => $c, 3 => $d); You probably want $this->a

Re: [PHP] Retrieving values from array on a class

2006-10-16 Thread Richard Lynch
On Sat, October 14, 2006 9:55 am, AR wrote: > $params_file = New returnConfigParams; > $params_file->getMySQLParams(); > print($params_file[0]); > > but doesn't work :( > > Help me please. > > I'm stuck on this for two hours and didn't find nothing on Google that > could help me. There's nothing w

Re: [PHP] Retrieving values from array on a class

2006-10-15 Thread Larry Garfield
On Sunday 15 October 2006 03:19, AR wrote: > Hi, > > > If you have an array assigned to a variable, you access elements of it > > with []. > > > > $foo = array('a', 'b', 'c'); > > > > print $foo[0]; // gives 'a' > > > > $bar = array('a' => 'hello', 'b' => 'world'); > > > > print $foo['b']; // gives

Re: [PHP] Retrieving values from array on a class

2006-10-15 Thread AR
Hi, > If you have an array assigned to a variable, you access elements of it with > []. > > $foo = array('a', 'b', 'c'); > > print $foo[0]; // gives 'a' > > $bar = array('a' => 'hello', 'b' => 'world'); > > print $foo['b']; // gives 'world' I know that. I had my class written as: ---

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread Larry Garfield
On Saturday 14 October 2006 19:09, AR wrote: > Hello, > > I've rewritten my class as you told me: > > -- > class returnConfigParams > > { > > private static $instance = NULL; > > var $a; > var $b; > var $c; > var $d; > > private

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread AR
Hello, I've rewritten my class as you told me: -- class returnConfigParams { private static $instance = NULL; var $a; var $b; var $c; var $d; private function __construct() { } // function that get the database pa

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread Kevin Waterson
This one time, at band camp, Roman Neuhauser wrote: BTW, here is my class: class returnConfigParams { var $a; var $b; var $c; var $d; function getMySQLParams() { include($_SERVER['DOCUMENT_ROOT']."/properties.php"); $values = array(0 => $a, 1 => $b, 2 => $c, 3 =

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-14 16:42:37 +0100: > > Just like you'd access members of any other array. > > > > $whatever = $params_file->getMySQLParams(); > > print($whatever[0]); > > > > This is a matter of basic rules of the language. Did you know > > most of the grammer is

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread AR
Hello, > Just like you'd access members of any other array. > > $whatever = $params_file->getMySQLParams(); > print($whatever[0]); > > This is a matter of basic rules of the language. Did you know > most of the grammer is described in the manual? Sure, i already tried that, b

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-14 16:28:57 +0100: > Hello, > > >> I have this class named "returnConfigParams" that returns an array > >> called "$values" through a function called "getMySQLParams()". > >> > >> My question is how to retrieve the values of the array from the file > >> that calls the

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread AR
Hello, >> I have this class named "returnConfigParams" that returns an array >> called "$values" through a function called "getMySQLParams()". >> >> My question is how to retrieve the values of the array from the file >> that calls the class. >> >> I have: >> >> $params_file = New returnConfigPara

Re: [PHP] Retrieving values from array on a class

2006-10-14 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-10-14 15:55:57 +0100: > Hello, > > Sorry for the newbie question :( > > I have this class named "returnConfigParams" that returns an array > called "$values" through a function called "getMySQLParams()". > > My question is how to retrieve the values of the array from t

[PHP] Retrieving values from array on a class

2006-10-14 Thread AR
Hello, Sorry for the newbie question :( I have this class named "returnConfigParams" that returns an array called "$values" through a function called "getMySQLParams()". My question is how to retrieve the values of the array from the file that calls the class. I have: $params_file = New return