What is the counterpart of Command.SqlParameters.AddWithValue() of .NET in PHP? I want to avoid SQL injection, I just wonder if PHP already has the same method aside from escaping strings thru mysql_real_escape().
Thanks in advance!
PDO's prepare() method and PDOStatement::bindParam() or PDOStatement::bindValue()
The difference between the two is bindParam() binds a reference to a variable. The variable value can change without having to re-bind the parameter. This is particularly useful in loops.
bindValue() simply binds a static value to a parameter.