Use both PDO prepared statemnts and filter_var?

dunkannuany

New Member
Hey guys, I'm learning OO PHP, and have been looking into PDO -- One thing I'm not clear on though is whether I should be using PDO prepared statements in conjunction with the filter_var() function or just by themselves. For instance, should I be doing\[code\]$query = $database->connection->prepare("SELECT name FROM acounts WHERE id = :id LIMIT 1");$query->bindParam(":id", $this->id, PDO::PARAM_INT);\[/code\]or something like this?\[code\]$id = filter_var($this->id, FILTER_VALIDATE_INT);$query = $database->connection->prepare("SELECT name FROM acounts WHERE id = :id LIMIT 1");$query->bindParam(":id", $id, PDO::PARAM_INT);\[/code\]
 
Back
Top