开发者

Passing return values from a function to bindParam in PDO

bindParam() doesn't seem to evaluate a function and then bind its return value to the parameter of the prepar开发者_运维百科ed statement, like so

$stmt->bindParam('foo', bar());

So, in order to get around this, is it good practice to do this instead?

$stmt->bindParam('foo', eval(bar()));

Or is there something else someone out there can recommend doing? Thanks!


Better to use bindValue() instead of bindParam(), it can pass values as well:

$stmt->bindValue('foo', bar());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜