I am new to OOP and how it works. I am having trouble figuring this out.
- I have a page called general.php which displays a members code, name etc
- I get the member's code using $_GET['code'] from the url.
- I get the member's other details from a database using the member's code through my CRUD class.
- I have a members class which contains properties such as code, name etc.
Should I create a new members object and assign the name to its name property or do I just get the data from the database and display it on the page? The object dies when I go to another page unless I put it into a session variable but I saw on other sites that it is not a good idea to do that.
I am struggling to understand the point of creating an unique members class object for all members in this case and not just a general members class object to call its functions when needed?
Hope I explained this okay.