Jump to content

OOP, PHP and MYSQL


ckrudelux

Recommended Posts

I been thinking for a long time about how to treat DB with PHP in a good way. I get stuck at if I should have a method creating the tables the class needs or I just create the table manually then I would need the class in a project.

So I started to search a bit on the topic and got some articles about data mappers which uses a class to do the bidding between the program and the database.

 

Article:

http://www.slideshare.net/vlucas/building-data-mapper-php5-presentation

 

Still I feel like I haven't found any good answers to my question on how the DB should be implement, maybe I just think about it too much. So I post this thread here in need of guidance, where my brain simply just make thing too complicated.

Link to comment
Share on other sites

Typically databases and their tables are setup once, manually, and the scripts just handle the basic CRUD operations. PDO is a good native library to use for interacting with databases and is highly encouraged for any new development.

 

I would probably create one class to handle the operations per table. Like Users, Products, etc.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...