This question is based on this thread.
Do you need the explicit sanitizing when you use pg_prepare?
I feel that pg_prepare sanitizes the user's input automatically such that we do not need this
$question_id = filter_input(INPUT_GET, 'questions', FILTER_SANITIZE_NUMBER_INT);
Context where I use Postgres
$result = pg_prepare($dbconn, "query9", "SELECT title, answer
FROM answers
WHERE questions_question_id = $1;");
$result = pg_execute($dbconn, "query9", array($_GET['question_id']));