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
$query = $database->connection->prepare("SELECT name FROM acounts WHERE id = :id LIMIT 1");
$query->bindParam(":id", $this->id, PDO::PARAM_INT);
or something like this?
$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);