prova a dare uno sguardo ai commenti
http://it.php.net/manual/it/function...rite-close.php
p.s.
se è stato selezionato allora esistecodice:... $r="select * from utenti where username= '$user' and password= '$pass'"; $res=mysql_query($r); $result=mysql_fetch_array($res); if ($result["username"]==$user and $result["password"]==$pass) { ...
quindi puoi scrivere
codice:$r="SELECT 1 FROM utenti WHERE username = '$user' AND password = '$pass'"; $res = mysql_query($r); if(mysql_num_rows($res) > 0) { echo "esiste"; $_SESSION['utente'] = $user; } else { echo "non esiste"; }