login form - how to match form data with the data in database.
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 .
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM agents";
$result=mysql_query($query) or die(mysql_error());
if($num > 0)
$sql = "SELECT agent FROM agents WHERE agent='$_POST[agent1]'
$result2 = mysql_query($sql) or die("Query died: fpassword");
$num2 = mysqli_num_rows($result2);
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.