function loginuser() {
$results=array();
$errors = array();
$username = 'abc';
$password = '123';
if ($username='') {
array_push($errors, "Username is required");
}
else if ($password='') {
array_push($errors, "Password is required");
}
$query = "SELECT * FROM users WHERE user_name='$username' AND user_pass='$password'";
$result = selection($query);
while ($row = mysqli_fetch_assoc($result)) {
$results[] = row_jsonify($row);
}
return json_encode($results);
return json_encode($errors);
}
Below is the code m printing but its throwing a sql error on console if i dont give a username or password i.e if i leave it empty like $username=' ';
what should i do here to print the errors on console as i dont have front end right now if the username or password is incorrect or empty