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";
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.