HI basically this is my problem.
I have created a database and
I have created a table.
I am trying to verify my username and password. HERE IS THE HTML PART.
<body>
<h1>Members login</h1>
<form method="post" action="check_login.php">
<label for="username">Username:</label>
<input type="text" name="username"/>
<label for="Password">Password:</label>
<input type="password" name="password"/>
<label for ="submit">Submit:</label>
<input type="submit" name="submit"/>
</form>
</body>
</html>
<?php
ob_start();
$host = "localhost";
$username="aproject_new";
$password = "root";
$db_name="aproject_new";
$tbl_name = "task_2";
mysql_connect("$host", "$username","$db_name", "$tbl_name", "$password" )or die (mysql_error("cannot connect"));
mysql_select_db ("$db_name") or die (mysql_error("cannot select database"));
$myusername =$_POST['username'];
$mypassword =$_POST['password'];
if (empty($_POST['username']))
{
echo "username is empty";
return false;
}
if (empty($_POST['password']))
{
echo "password is empty";
return false;
}
$sql ="SELECT * FROM 'task_2' WHERE username = '$myusername' and password = '$mypassword'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if ($count == 1)
{
echo "success! $count";
}else{
echo "unsuccessful! $count";
}
ob_end_flush();
?>
the main error I have been getting for along time is:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
can anyone please help.
Thank you very much