Skip to content

Instantly share code, notes, and snippets.

@NoMan2000
Last active December 30, 2015 21:49
Show Gist options
  • Save NoMan2000/7890148 to your computer and use it in GitHub Desktop.
Save NoMan2000/7890148 to your computer and use it in GitHub Desktop.
Filter input, sanitize output
<?php
// if the value passed into the GET should be an int.
$intStorage = intval($_GET['someValue']);
// Using PDO
$db = new PDO();
$query = $db->prepare("SELECT someRow FROM table WHERE value = ?");
$query->bindParam(1,$bindedValue);
// The first argument is number of prepared statements, second is the value.
$query->execute();
// Boolean false if nothing is found.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment