Python Forum
Problem applying conditions against results back from a database
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem applying conditions against results back from a database
#1
Hey guys I'm trying to compare user input with what's in the database to see if they can login or not.

I'm getting a list back from the input and it's adding paranthesis and commas and apostrophes to each value so it's not matching up when compared.

How can I get rid of these extra special characters?

Thanks

@app.route("/login", methods=["GET","POST"])
def login():
    password = request.form.get("password")
    username = request.form.get("username")
    usernamedata = db.execute("SELECT username FROM users WHERE username=:username", {"username":username}).fetchone()
    passworddata = db.execute("SELECT password FROM users WHERE username=:username", {"username":username}).fetchone()
    print(usernamedata)
    print(passworddata)
    print(username)
    print(password)
    if username == usernamedata and password == passworddata:
        return render_template("login.html")
    else:
        return render_template("login.html")
Reply


Messages In This Thread
Problem applying conditions against results back from a database - by card51shor - Jun-12-2020, 12:41 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 02:59 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 03:48 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 04:01 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 04:09 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 05:03 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 05:05 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 05:07 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 05:09 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 05:10 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 05:12 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 05:14 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 05:17 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 05:24 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 05:27 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 05:29 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 05:33 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 05:35 AM
RE: Problem comparing two values - by ndc85430 - Jun-12-2020, 05:41 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 06:04 AM
RE: Problem comparing two values - by card51shor - Jun-12-2020, 11:54 PM
RE: Problem comparing two values - by pyzyx3qwerty - Jun-13-2020, 05:12 AM
RE: Problem comparing two values - by Yoriz - Jun-13-2020, 08:51 AM
RE: Problem comparing two values - by card51shor - Jun-13-2020, 05:21 AM
RE: Problem comparing two values - by pyzyx3qwerty - Jun-13-2020, 07:56 AM
RE: Problem comparing two values - by card51shor - Jun-13-2020, 04:36 PM
RE: Problem comparing two values - by Yoriz - Jun-13-2020, 05:00 PM
RE: Problem comparing two values - by card51shor - Jun-13-2020, 05:13 PM
RE: Problem comparing two values - by Yoriz - Jun-13-2020, 05:19 PM
RE: Problem comparing two values - by card51shor - Jun-13-2020, 05:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  applying total in a loop to a list JustinxFFx 1 2,275 Feb-11-2018, 03:14 AM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020