I have developed a website based on 10 tables in a MYSQL database & I wish to create a CMS that allows the customer to add/edit/remove records.
I have created pages in PHP that achieve this before but it is a long laborious process to churn out 3 pages per table (this site would require 30 such pages) and I am looking to simplify the process.
Here is the concept:
What I would like to build is a CMS based on five template pages Menu, Table, Add, Edit, Delete. Each page would populate dynamically according to the table they are associated with.
Menu page would list all of the tables and each would link to a table page template. The link would carry the table name as a variable ($table). This one is easy enough.
The Table page would list the contents of the table selected, each row linking to the Edit and to the Delete page, with a link to the Add page.
The subsequent pages would need to display a form containing a textfield for each table field where the table =$table (the Edit link would also carry the variable $id).
For the Add page the form would need to extract the data entered in the textfields and put them into an insert query.
For the Edit page the form would need to extract the data entered in the textfields and put them into an update query.
The delete page would be a simple delete where id = $id situation (all table rows have a unique id).
My dilemma surrounds:
- The Insert/Update queries – how would I structure this to accept varying values and varying destination fields? Do I convert the values into arrays?
I am sure other questions may arise but should be grateful for a nudge in the right direction. Thanks.
(PS I have considered an off the shelf CMS solution but am anxious to learn.)
I have created pages in PHP that achieve this before but it is a long laborious process to churn out 3 pages per table (this site would require 30 such pages) and I am looking to simplify the process.
Here is the concept:
What I would like to build is a CMS based on five template pages Menu, Table, Add, Edit, Delete. Each page would populate dynamically according to the table they are associated with.
Menu page would list all of the tables and each would link to a table page template. The link would carry the table name as a variable ($table). This one is easy enough.
The Table page would list the contents of the table selected, each row linking to the Edit and to the Delete page, with a link to the Add page.
The subsequent pages would need to display a form containing a textfield for each table field where the table =$table (the Edit link would also carry the variable $id).
For the Add page the form would need to extract the data entered in the textfields and put them into an insert query.
For the Edit page the form would need to extract the data entered in the textfields and put them into an update query.
The delete page would be a simple delete where id = $id situation (all table rows have a unique id).
My dilemma surrounds:
- The Insert/Update queries – how would I structure this to accept varying values and varying destination fields? Do I convert the values into arrays?
I am sure other questions may arise but should be grateful for a nudge in the right direction. Thanks.
(PS I have considered an off the shelf CMS solution but am anxious to learn.)