php - Use one bind_param() with variable number of input vars -
I try to use variable binding in this way:
$ stmt = $ Mysqli-> and; ("Mytable SET myvar1 =?, Myvar2 = ... WHERE id =?") {$ Stmt-> Bind_param ("ss ...", $ _POST ['myvar1'], $ _POST ['myvar2'] ...); But some $ _POST ['...'] may be empty so I do not want to update them in DB.
This is not practical, keeping in mind all the different combinations of empty $ _POST ['...'] and although I can create my updates "Update mytable SET ..." , Bind_param () is a different animal.
I can try to make my call as a string and use eval on it, but it does not look right: (
You can use the function to call the bind_param method with a variable number or argument:
Comments
Post a Comment