Problem with returned from the database in class |
You were asking why the object properties are not public.
Well, maybe because you declared them as protected in the User_lib class yourself? PHP Code: class User_lib { If properties are public, you can set them anywhere in your application like this: PHP Code: $this->User_lib->email = '[email protected]'; If properties are private or protected, you need a __set() method inside your object to change the value. Like this: PHP Code: public function __set($name, $value) This is a so-called magic method. It will be automatically called when you try to change the value of a non-public property. |
Messages In This Thread |
Problem with returned from the database in class - by phpforever2017 - 02-24-2017, 06:19 AM
RE: Problem with returned from the database in class - by Wouter60 - 02-25-2017, 03:58 AM
RE: Problem with returned from the database in class - by ignitedcms - 02-26-2017, 08:47 AM
RE: Problem with returned from the database in class - by Wouter60 - 02-27-2017, 12:19 AM
RE: Problem with returned from the database in class - by phpforever2017 - 02-27-2017, 05:06 AM
RE: Problem with returned from the database in class - by Wouter60 - 02-27-2017, 12:42 PM
RE: Problem with returned from the database in class - by phpforever2017 - 02-28-2017, 01:57 AM
|