ravinggenius Posted August 27, 2008 Share Posted August 27, 2008 Is there any kind of rule as to which one I should use? Can anybody explain the differences to me? Quote Link to comment Share on other sites More sharing options...
ridiculous Posted August 27, 2008 Share Posted August 27, 2008 I just started working with PDO the other day and went through this. I don't think there is any kind of performance difference between the two...just that one is more spelled out in appearance than the other. Quote Link to comment Share on other sites More sharing options...
ravinggenius Posted August 28, 2008 Author Share Posted August 28, 2008 I haven't been able to tell a difference, but I'm using bindParam for UPDATE or INSERT values and bindValue for WHERE clauses. Hopefully that's what the developers had in mind.... Quote Link to comment Share on other sites More sharing options...
mtarroyo Posted May 27, 2010 Share Posted May 27, 2010 If you use PDOStatement::bindParam() to replace the parameter marks, the variables are passed by reference and if there are any return value, they will fill the variables. So, you can pass only variable containers. Like this: $stmt->bindParam(1, $name); Because strings cannot be passed by reference. Using PDOStatement::bindValue() the values are not passed by reference and you can do things like that: $stmt->bindValue(1, 'Mario'); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.