Jul 11

When you're only expecting an integer value, do something like this in your code:

if(is_numeric($_GET['id'])){
	$query = "SELECT name WHERE id = '" . $_GET['id'] . "'";
}
else{
	die("ID is not numeric.");
}

Also, this is another way:

$query = "SELECT name WHERE id ='" . intval($_GET['id']) . "';

It'll save you some headaches :)

  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.