mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-22 21:22:54 +02:00
Remove filter_input from PDO example
This commit is contained in:
@@ -43,7 +43,7 @@ you should sanitize the ID input using PDO bound parameters.
|
||||
<?php
|
||||
$pdo = new PDO('sqlite:users.db');
|
||||
$stmt = $pdo->prepare('SELECT name FROM users WHERE id = :id');
|
||||
$stmt->bindParam(':id', filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT), PDO::PARAM_INT);
|
||||
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT); //<-- Automatically sanitized by PDO
|
||||
$stmt->execute();
|
||||
{% endhighlight %}
|
||||
|
||||
|
Reference in New Issue
Block a user