DB
<?php 
$Dname 
mysql_real_escape_string($_POST['name']);
$Dage  = (int)$_POST['age'];
$row mysql_query("select from users where name='$Dname' and age='$Dage'");
?>
Or use ? parameters in PEAR::DB and PDO. PDO also supports named parameters.

Named Parameters
<?php 
$pdo 
= new PDO('mysql:dbname=testdb');

$sql 'SELECT name, colour, calories
        FROM fruit
        WHERE calories < :calories AND colour = :colour'
;
$prep $pdo->prepare($sql);
$prep->execute(array(':calories' => 150':colour' => 'red'));
$red $prep->fetchAll();
$prep->execute(array(':calories' => 175':colour' => 'yellow'));
$yellow $prep->fetchAll();
?>
Shell
<?php 
$_POST
['name'] = "/tmp;cat /etc/passwd";

$Sname escapeshellarg($_POST['name']);
system("ls $Sname 2>&1");
?>
Output
ls: cannot access '/tmp;cat /etc/passwd': No such file or directory