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
#27
In the case of When I login with the incorrect username and password - I get an error.
what are the returned values from
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()
and what do you expect them to be.

What is db, what database package does it refer to, what does the documentation state it will return from the method fetchone when there are no records.

If it returns None you will get the error
usernamedata = None

usernamedata[0]
Error:
TypeError: 'NoneType' object is not subscriptable
Reply


Messages In This Thread
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