Re: problem with class
| From: | Jonathan Pitcher | Date: | Fri, 25 Apr 2003 15:02:22 +0000 |
| Subject: | Re: problem with class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145269@lists.php.net to get a copy of this message | ||
I would try two things to further test your code.
1,) in db.set I would add the following line before setting any of $Conf's values.
global $conf;
2.) in function Echo I would add a third line to make sure the function is being called.
echo "Echo Called<br />";
Jonathan Pitcher
On Friday, April 25, 2003, at 09:55 AM, Prince wrote:
ok took the [] out of the $conf array and tried it again but for some strange reason when i try to echo them it doesnt really work... all i get is a blank screen when i know for a fact that something is in the elements of that array... ----- Original Message ----- From: "Jonathan Pitcher" <jpitcher@cfedc.com> To: "Prince" <friendly@kaltelnet.net> Cc: <php-general@lists.php.net> Sent: Friday, April 25, 2003 10:33 AM Subject: Re: [PHP] problem with classWhen you want to global an array do it the same way you do a variable. global $conf; // GOOD global $conf[]; // BAD remove the [] from your global line and you should be good to go. Jonathan Pitcher On Friday, April 25, 2003, at 09:38 AM, Prince wrote:hi.. i have in an include file this: ##db.set## //variable used in other files $conf["date"]=date("M-d-Y"); $conf["log"]=date("M-d-y"); //...... ##end## now in the class file i have this: ##db.lib### require("db.lib"); classdb{ var $_db=""; global $conf[];//make the $conf array global now..worked //before but doesnt work now //now try to use it function Echo(){ echo $conf["date"]; echo $conf; }} ###end### now on output all i get for an error was parse error expecting t_old_function t_function t_var or } in db.lib on line 8 and for some reason it comes back to that $conf array in the other file... if i take out the global $conf[]; statement out of the class and put it just under the require statement or if i put it inside a function statement it will make the error go away but when i try to echo them it comes up with a blank screen what is wrong with it.. i did this once before and it worked but dont know why this time its not working... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php