Password validation
<p>I developed code in PHP but it's not working. Sometimes the code works but most of the time not. The problem is in showing whether the password is valid or not.sorry friends i forgot to changed that but my problem with it only show invalid even i entered valid user name and password..plz help me</p>

<pre><code>if(isset($_POST['submit']))
{
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("billmailid", $con);
        if (!$con)
            {
        die('Could not connect: ' . mysql_error());
            }
$username=$_POST['usernameid'];
$password=$_POST['passwordid'];

$result = mysql_query("SELECT * FROM login");


$check = mysql_query("SELECT username FROM login WHERE username = '$username' &amp;&amp; password= '$password'") ;

$check2 = mysql_num_rows($check);

if($check2==1)
  {
   echo "valid";
  }
else
  {
  echo "invalid";
  }
}
?&gt;
</code></pre>
