pdostatement::bindparam-k8凯发旗舰
/* 通过绑定的 php 变量执行一条预处理语句 */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('select name, colour, calories
from fruit
where calories < ? and colour = ?');
$sth->bindparam(1, $calories, pdo::param_int);
$sth->bindparam(2, $colour, pdo::param_str);
$sth->execute();
?>
example #3 使用 inout 参数调用一个存储过程
/* 使用 inout 参数调用一个存储过程 */
$colour = 'red';
$sth = $dbh->prepare('call puree_fruit(?)');
$sth->bindparam(1, $colour, pdo::param_str|pdo::param_input_output, 12);
$sth->execute();
print("after pureeing fruit, the colour is: $colour");
?>