For example, if two SQL statements, sql1 and sql2.sql2, need the result of sql1 execution, then I should $ ressql1if ($ res) {code ...}} or are these two sqls written as a stored procedure for calling? Which method is more reasonable and formal? Thank you !!! For example, there are two SQL statements: sql1 and sql2.
Sql2 requires the result after sql1 execution, then I should
$ Res = sql1
If ($ res ){
Sql2
}
Or are these two sqls written as a stored procedure for calling? Which method is more reasonable and formal? Thank you !!!
Reply content:
For example, there are two SQL statements: sql1 and sql2.
Sql2 requires the result after sql1 execution, then I should
$ Res = sql1
If ($ res ){
Sql2
}
Or are these two sqls written as a stored procedure for calling? Which method is more reasonable and formal? Thank you !!!
It doesn't matter which method to use. However, you need to unify it. You should not use a stored procedure and use the code to judge this case again, which is not easy to maintain.
This is a problem in the selection of development methods. Generally, the overall principle will be determined before system development. Whether the business logic is put in php or a database, if you choose to put it in a database, php calls a stored procedure to complete the required business operations.
If the system is relatively simple, it is easier to develop it in php.