Notice: Undefined variable: username in C:\xampp\htdocs\test_class.php
on line 20
Notice: Undefined variable: password in C:\xampp\htdocs\test_class.php
on line 20
I get the above error when i use this piece of code for checking down my username and password with my database.
<?php
class test_class {
public function __construct() {
}
public function doLogin() {
include("connection.php");
if (isset($_POST['username']))
{
$username= $_POST['username'];
}
if (isset($_POST['password']))
{
$password= $_POST['password'];
}
$query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
$result = mysql_fetch_array(mysql_query($query));
if(!$result)
{
return 'assa';
}else{
return 'assa112121212';
}
}
}
?>