Im trying to make a log in form in PHP and Im stuck in the part where it matches the value filled by the user aginst the data stored in the database(MySql). Im not sure where Im making error as Im new to PHP so please help .

<?php

include("dbinfo.inc.php");
$con=mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM agents";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
//print $num;

if($num > 0)
{
$sql = "SELECT agent FROM agents WHERE agent='$_POST[agent1]'
AND street='$_POST[street1]'";
$result2 = mysql_query($sql) or die("Query died: fpassword");
$num2 = mysqli_num_rows($result2);
//print $num2;
}
if($num2 > 0) //password matches
{
echo "match it is !!";
}
?>
Explanation: I want my form to match the data entered by the user in "agent1 and street1" field against the data already stored in the database and if it matches then show me the next page.

Thanks.