You are using double quoting you put quotes around $_POST['email'] and inside it making it get interpreted the wrong way
This would work the right way:
$q = query('select * from users where email = '.$_POST['email'].' and name = '.$_POST['name']);
But even if it works it is still wrong to pass post variables right into a query. As a developer you need to learn to 'never trust the users'. So the best thing is to clean it by escaping it like this:
$name = mysql_real_escape_string($_POST['name']);
$email = mysql_real_escape_string($_POST['email']);
$q = query("select * from users where email = $email and name = $name");
or this:
$q = query('select * from users where email = '.mysql_real_escape_string($email).' and name = '.mysql_real_escape_string($name));
(what way you prefer)