I am new in php and I have created a php login page where it will retrive data from a table and check a print "login successful" or "login failed". Now after execution of the codeI am giving correct data but all the time it is replying "login failed" plese help me
<?php
$hostname = 'localhost';
$dbname = 'phplog';
$username = 'root';
$password = '';
mysql_connect($hostname, $username, $password);
mysql_select_db($dbname);
$use = $_POST['data'];
$use = stripslashes($use);
$use = mysql_real_escape_string($use);
$get = "SELECT * FROM user WHERE username='$use'";
$set = mysql_query($get);
$row = mysql_num_rows($set);
if($row == 1){
print("login successful");
}
else{
print("Login failed");
}
?>