Found it and tested too! it does works now

PHP Code: 
<?php

if (isset($_POST["boxuser"]) and isset($_POST["boxpass"])) { // use checks to prevent from direct page access

$conmysql_connect("localhost","usermaster","") or die (mysql_error());
$cNamemysql_real_escape_string($_POST["boxuser"]); // prevent mysql injections
$cPassmysql_real_escape_string($_POST["boxpass"]); // prevent mysql injections
mysql_select_db("mynewdb"$con);
//$query = "select * from mytable where uname=".$cName."and upass=".$cPass;
$query "SELECT * FROM mytable WHERE uname='$cName' and upass='$cPass'";
$result mysql_query($query$con);
$row mysql_num_rows($result);

if (
$row 0)
{
    echo 
"Login successful.";
}
else
{
    echo 
"Login failed.";
}
mysql_close();

} else {

    die(
'RETRY AGAIN FROM THE LOGIN PAGE');

}

?>
The problem was in sql query where the value to check was directly given which was making query take it as unique column.