But, why do you want to make one connection to ask for the user and another to ask for the mail?
If you want to generate different messages, then you should try making a union in you query, like this:
select user valid_user from table where user=$user
union
select user valid_userpass from table
where user=$user
and pass=$pass
So, you have covered the three posibilities in just one query, much faster.
Hope you've undestood something.