I might be a trivial questions, but I dare ask, please help me answer this questions.
I have been developing a PHP Mysql Application. Earlier, I used to use the following principle :
- Validate the HTML form through Javascript
- Error Validation in PHP by checking each of the input
- If successful, update the Database through a single MySQL query
Now, I am following another approach as follows :
- No Javascript Validation, but use
requiredattribute in the form where input is necessary - Error validation of each of the input element in PHP and simultaneously update the database
So, in the second approach, I am using, I am making multiple MySQL query( around 30 queries) for each row update.
I know, it might not result in an optimal performance, but,
- it has reduced the number of lines of code by a factor of atleast 3( if not more).
- It is much easier to Develop, Debug, and collaborate
- Development time is much less (by my own estimate, by a factor of 5)
I would like your thoughts on the second approach, I am currently using in my application.
require, but still build 1 query?