Tips on Structure

admin

Administrator
Staff member
I am thinking through a new standard coding structure for myself to make the generation of new PHP forms for interfacing with a MySQL database easier.

In the past I had an "basic view" page, "add page", "edit page" and "delete page". Each had the necessary switched and conditionals to follow the process from listing options to confirmation. Seperate files included for common bits, etc. Probably not that unusual a system.

Find it a hassel when using this as a template for new forms with new databases though.

Also combined all the add / update / delete features to one admin form, but that was nto very efficient use of code.

What is peoples proference? Separate files? long files?

I am now thinking that it makes more sense to break it to two php pages, one contains the displaying code and the other several sections.

1) Form. Use the samne form in adding / editing.

2) Confirmation section.

3) Execution Section, the INSERT, UPDATE & DELETE SQL statements.


I know there is no one sysetm that is necessarily best and it comes down to the writing of the code, btu I think my proposal above would be efficient and minimise on redundancy.

Any thought are insights before I restructure my templates :-)

Thanks,
Tim
 
Back
Top