designanddev Posted December 29, 2012 Share Posted December 29, 2012 im using this code here to instantiate all my records from the data, but i am having trouble trying to use the join another table cell to this private function instantiate($record){ $object = new self; //$object->username = $record['username']; //$object->password = $record['password']; //$object->first_name = $record['first_name']; //$object->last_name = $record['last_name']; foreach($record as $attribute => $value){ if($object->has_attribute($attribute)){ $object->$attribute = $value; } } return $object; } Quote Link to comment https://forums.phpfreaks.com/topic/272502-instantiate/ Share on other sites More sharing options...
timothyarden Posted December 30, 2012 Share Posted December 30, 2012 Private Function can only be used and called to inside the class it is defined in (if I'm right) which means that when you call new self it runs a endless loop. I tried running something similar to test that this was right and it returned this: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes) Quote Link to comment https://forums.phpfreaks.com/topic/272502-instantiate/#findComment-1402111 Share on other sites More sharing options...
ignace Posted December 30, 2012 Share Posted December 30, 2012 but i am having trouble trying to use the join another table cell to this no idea what you are talking about. Quote Link to comment https://forums.phpfreaks.com/topic/272502-instantiate/#findComment-1402172 Share on other sites More sharing options...
cpd Posted December 30, 2012 Share Posted December 30, 2012 Look up the terms instantiation, joining tables, classes, methods and method visibility. Once you understand all of them re-write your question because it makes absolutely no sense at the moment. Quote Link to comment https://forums.phpfreaks.com/topic/272502-instantiate/#findComment-1402180 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.