The bindParam () method is very similar to bindValue. The only difference is that the former uses a PHP variable to bind a parameter, while the latter uses one. Therefore, bindParam is the second parameter and can only be used with the variable name, but not with the variable. bindValue can be used as specific. $ Stm $ pdo-prepare (select * fromuserswhereuser
The bindParam () method is very similar to bindValue. The only difference is that the former uses a PHP variable to bind a parameter, while the latter uses one. Therefore, bindParam is the second parameter and can only be used with the variable name, but not with the variable. bindValue can be used as specific. $ Stm = $ pdo-prepare (select * from users where user =
The bindParam () method is very similar to bindValue.
The only difference is that the former uses a PHP variable to bind a parameter, while the latter uses a value.
Therefore, bindParam is the second parameter. Only the variable name can be used, but not the variable value. bindValue can use the specific value.
$ Stm = $ pdo-> prepare ("select * from users where user =: user"); $ user = "jack"; // correct $ stm-> bindParam (": user ", $ user); // error // $ stm-> bindParam (": user "," jack "); // correct $ stm-> bindValue (": user ", $ user); // correct $ stm-> bindValue (": user "," jack ");
In addition, bindParam can be bound to an input/output variable in the stored procedure, as shown below
$ Stm = $ pdo-> prepare ("call func (: param1)"); $ param1 = "abcd"; $ stm-> bindParam (": param1 ", $ param1); // correct $ stm-> execute ();
After the execution of the stored procedure, the result can be directly reflected to the variable.
For the big data block parameters in the memory, the performance should be considered first.
Via http://anfirst.cn/archives/1030