What is wrong with this code...please help
Posted: Mon Jun 15, 2009 11:15 am
please see the code below. I'm not able to figure out why it is showing error.
Have colored the area where showing error:
-------------------------------------------------------------------------
<html>
<head>
<title>Login.php</title>
</head>
<body>
<?php
$con=mysql_connect("localhost","root","");
$query="mysql_select_db(login)";
mysql_query($query);
$username=$_POST['username'];
$password=md5($_POST['password']);
$chk_user="select name for users where username='$username'";
$user_exist=mysql_num_rows($chk_user);
if($user_exist != 1)
{
echo "Incorrect login";
include "login.html";
exit();
}
else
{
echo "login successfull";
}
?>
</body></html>
----------------------------------------------
saying incorrect use of mysql_num_rows,
and not accepting any username and password, always show incorrect login
P.S. : Attaching other related php and html files
Have colored the area where showing error:
-------------------------------------------------------------------------
<html>
<head>
<title>Login.php</title>
</head>
<body>
<?php
$con=mysql_connect("localhost","root","");
$query="mysql_select_db(login)";
mysql_query($query);
$username=$_POST['username'];
$password=md5($_POST['password']);
$chk_user="select name for users where username='$username'";
$user_exist=mysql_num_rows($chk_user);
if($user_exist != 1)
{
echo "Incorrect login";
include "login.html";
exit();
}
else
{
echo "login successfull";
}
?>
</body></html>
----------------------------------------------
saying incorrect use of mysql_num_rows,
and not accepting any username and password, always show incorrect login
P.S. : Attaching other related php and html files