View Full Version : PHP OOP way in inserting data from form to database?
13 Dec 2011, 07:52 PM
hello i am practicing OOP and i am very sad to see that i have not found any resources that can help me how to insert data to the database coming from an HTML form. I know how to do it in a structured manner. but now i am trying to figure it out in an OOP and industry standards way. can any one give me a sample. or direct me to a proper way. I lost man. thanks and more power.
15 Dec 2011, 01:22 PM
"Database" is such a broad term. I assume you are referring to a relational database system*. In that case, you will need to "map" the domain model to and from the relational model. There are various documented architectural patterns to accomplish this.
A few notable ones are:
Active Record Pattern (http://en.wikipedia.org/wiki/Active_record_pattern)
Table Data Gateway Pattern (http://en.wikipedia.org/wiki/Table_data_gateway)
Object-Relational Mapping (http://en.wikipedia.org/wiki/Object-relational_mapping)
That should get you started. Have at look through those and feel free to ask more specific questions.
*Other database systems require different approaches.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.