Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8400859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:39:23+00:00 2026-06-09T21:39:23+00:00

I have user input/ login as following: login:- write(‘username: ‘), read(User), nl, write(‘password: ‘),

  • 0

I have user input/ login as following:

login:- write('username: '), read(User), nl, write('password: '), read(Pass).

and i have a database with usernames and passwords. I use find predicate to get all rows as a list like shown in the code:

find(R):-findall(Row, rs('SELECT name FROM patient where name=\'James\'', Row), R).

?- find(R).
 R = [row('James'), row('James'), row('James'), row('James')].

Is there a way to use user input from read() and check if that user is in database?

I tried member(User, R) but it’s not working properly.

I know prolog is not best language for this kind of stuff(login/registration). The reason why I’m doing this is that i’m working on helath care expert system in swi-prolog and i need login and reg for patients.

Is there a why this can be done? I’m new to prolog so im getting stuck on lots of stupid things.

Thanks!

………….
@gusbro I tried with member(row(User) as you told me:

check:-findall(Row, rs('SELECT name FROM patient where name=\'James\'', Row), R),
read(User), member(row(User), R); 
write('wrong username!').

But i always get the same no matter what i write:

?- check.
|: Bla.
true ;
wrong username!
true.

?- check.
|: James.
true ;
wrong username!
true.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:39:25+00:00Added an answer on June 9, 2026 at 9:39 pm

    What you tried didn’t work because you are trying to unify terms of the form row(Atom) with Atom.

    It should work fine if you do member(row(User), R).

    However, note that in your example it will succeed more than once because you have repeated “rows”…

    You might want to consider using setof/3 instead of findall/3, as it will eliminate duplicates from the resulting list (and as a side effect if will fail if there are no matches of the template of setof)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a login form that has Username and password as inputs from user
I have following code: div.accountPage div.acct-form.login div.acct-header Log-in form.loginForm.login input(id=username, type=text, name=User, placeholder=Username, value=)
I have a Login page that captures User input like this. MD5calc ss =
I have the following requirement: Based on some user input, I need to generate
I have a form with some text-inputs: login, password. If user sees this form
I have a Partial view (Login, with username, password and Submit button), and the
I have the following code that checks for both the username and password but
I have the following View code: @using (Html.BeginForm(Login, Press, FormMethod.Post)) { <fieldset> <legend>User Registration</legend>
I have the following code for my login view: <?php echo $session->flash('auth'); echo $this->Form->create('User',
I have the following form: <form:form method=POST action=signin.dlp commandName=user > <form:input path=useremail id=useremail /><FONT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.