I am using PDOs first time on my project and have some confusions in my mind and wanted to clarify:
Everyone recommends PDOs because it prevents from SQL injection so
- Do we need to apply other functions before making query like
strip_tags
OR they aren't necessary with PDOs?
- Do we need to apply other functions before making query like
What is different betweeen
:username
andusername
?Example:
$stmt = $db->prepare("SELECT id FROM USERS WHERE username=:username); $stmt->bindParam(":username", $username); $stmt->bindParam("username", $username);
Does this prevent from SQL injection?
PDO::PARAM_STR
which is used as third parameter inbindParam
statementIs it necessary to close connection by setting connection object to null in end? like
$db = null;