0

Hi, i've been trying to make a simple login script php and have come across these error messages


Notice: Undefined variable: pass in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_t013534/public_html/adminlog.php on line 15

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_t013534/public_html/adminlog.php on line 18


The code i've used so far is:

<form name = "adminlog" 
   id = "adminlog" method = "post"
   action = "adminlog.php">


Username:
<input type = "text" 
  name = "username" id = "username" />
	
Password:
<input type = "password" 
  name = "pass" id = "pass" />

<input type = "submit" value = "Log In" />
</form>

and:

<?php 
$username = $_POST['username'];
$password = $_POST['pass'];

include'database_conn.php';

$sql="SELECT * FROM userlog WHERE username='$username and password='$pass'";
$result=mysql_query($sql);

$count=mysql_num_rows($result);

if($count==1){

echo "Welcome";
}
else {
echo "Wrong Username or Password";
}
?>
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.