This article describes how to use php to dynamically bind variables. It involves php variable determination and dynamic definition related skills. For more information, see
This article describes how to use php to dynamically bind variables. It involves php variable determination and dynamic definition related skills. For more information, see
This example describes how to use php to dynamically bind variables. Share it with you for your reference. The details are as follows:
Private function bindVars ($ stmt, $ params) {if ($ params! = Null) {$ types = ''; // initial sting with typesforeach ($ params as $ param) {// for each element, determine type and addif (is_int ($ param) {$ types. = 'I'; // integer} elseif (is_float ($ param) {$ types. = 'D'; // double} elseif (is_string ($ param) {$ types. ='s '; // string} else {$ types. = 'B'; // blob and unknown} $ bind_names [] = $ types; // first param needed is the type string // eg: 'isss' for ($ I = 0; $ I
I hope this article will help you with php programming.
,