-2

Question, what is a good way to handle large CRUD web pages?

My current process is this:

  • I make/edit the SQL table with IDs
  • I get another set of IDs in the HTML form, which is sent to a PHP page
  • In the PHP page, I put all the SQL IDs in a mysqli prepare statement
  • Then, I put all the HTML IDs in the bind_params

This process works. However, I have nearly a dozen pages like this, each with ~8 variables. Repeating these keys 4 times is getting ridiculous, because that's 12 * 8 * 4 = 384 chances for me to flub the spelling/ordering, for the "create" part alone.

Not only is this a pain to implement, I need to do a massive amount of testing to make sure I haven't crossed any wires, to say nothing about business logic.

Thoughts? We're in a big refactoring process, so solutions out of a LAMP stack are perfectly welcome. I'm comfortable in PHP and (non-tomcat) Java, but willing to learn anything.

3
  • Are you creating the pages by hand? Why aren't you using one of the bazillion tools that automatically creates the mapping based on parsing the schema? – whatsisname Aug 13 '20 at 2:04
  • @whatsisname, any suggested tools? (I don't want to make this a product recommendation question, but I don't know what to look up) – Kyle Aug 13 '20 at 2:23
2

This question is broad, but I guess it can be answered nevertheless in an evenly broad, still comprehensive manner. You observed that the manual creation of the different layers behind a web application, especially when it is just a CRUD application, is very cumbersome. You are definitely not alone with that observation.

This is exactly the reason why today we have dozens (maybe hundreds) of different web application development frameworks. And lots of them really shine when the task is mainly CRUD. Most of these frameworks have things like code generators, HTML generators, template filling mechanics, automatic SQL generation and binding mechanics. So they will help you to make the ever-repeating tasks less tedious and less error-prone.

So, no, I am not going to recommend you one, but since you are mentioned PHP, just google for "php frameworks", and you will find plenty of "Top 10 PHP framework" articles. Pick one which suits your needs. Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.