Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Piotr Stefański
Piotr Stefański
3,671 Points

How to design my php application using oop

Hello Community,

I am in the process of designing my football predictor web application where users will be able to bet games(win,draw or lose) and based on that bets users will gain points.

I am going to use MySql as a central storage database. I already prepare my database but I am not sure how to design oop model. I am thinking about three classes: Database, Application and User.

My question is how to correctly create classes in OOP, should every single table from database be a class?

Another question is how to store selected data from database in user session, arrays?

Thank you for your help.

Peter

1 Answer

Jordan Hausman
Jordan Hausman
5,275 Points

If you haven't already I would check out this course https://teamtreehouse.com/library/objectoriented-php-basics-2 It's a full guide to basic object oriented programming using php. I would also check out https://teamtreehouse.com/library/php-user-authentication for information on passing user information and storing data. Hope that helps a little!