Parse error: parse error, unexpected T_ARRAY, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\wwwroot\stwerburghs.org\obj\contacts.obj.php on line 6
Fatal error: Cannot instantiate non-existent class: contacts in d:\wwwroot\stwerburghs.org\cms\list_contacts.php on line 9
At 14:44 08/08/2003 +0100, David Nicholson wrote:
Hello,
This is a reply to an e-mail that you wrote on Fri, 8 Aug 2003 at 14:18, lines prefixed by '>' were originally written by you. > I wish to pass a session variable into an object and have it available > as > an attribute. I have what I thought I needed below as a code segment > but > it douse no work. Has anybody got any idea how I should achieve this. > Ben > ....... > class Contacts{ > var $db; > array $SESSION; > function Contacts( $SESSION, $db ) { > $this->$SESSION = $SESSION; > $this->$db = $db; > }
That will work fine for reading from the variable, are you wanting to write to it and have the changes made available outside of your class? if so pass the array in by reference... function Contacts( &$SESSION, $db )
HTH,
David.
-- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler/
Professional Web Development by David Nicholson http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
**************************************************************** * Ben Edwards Tel +44 (0)1179 553 551 ICQ 42000477 * * Homepage - nothing of interest here http://gurtlush.org.uk * * Webhosting for the masses http://www.serverone.co.uk * * Critical Site Builder http://www.criticaldistribution.com * * online collaborative web authoring content management system * * Get alt news/views films online http://www.cultureshop.org * * i-Contact Progressive Video http://www.videonetwork.org * * Fun corporate graphics http://www.subvertise.org * * Bristol Indymedia http://bristol.indymedia.org * * Bristol's radical news http://www.bristle.org.uk * ****************************************************************
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php