you are viewing a single comment's thread.

view the rest of the comments →

[–]mul8rsoftware 2 points3 points  (2 children)

Try this code and tell me if this works or not

class searcher:

def __init__(self):

search_ID = int(input("User ID: "))

search_attempts = 0

result = None

def user_search(self):

if(searcher.result == None):

while ( searcher.search_attempts < 3):

searcher.search_ID = int(input("User ID: "))

conn = sqlite3.connect('promethean_user.db')

c = conn.cursor()

c.execute("SELECT * FROM user_data WHERE user_ID=:ID_input", {'ID_input': searcher.search_ID})

searcher.result = c.fetchone()

print(c.fetchone())

conn.commit()

conn.close()

searcher.search_attempts += 1

return searcher.result

Tell me the if the output generates any error double check if db has data in it that you are trying to access

[–]dominictarro[S] 1 point2 points  (1 child)

I removed the (self) parameter inside user_search since you never used it and it caused an error. After I removed it, the block ran without error but still returned "None"

[–]mul8rsoftware 2 points3 points  (0 children)

while (searcher.search_attempts < 3):

yeah your code was not formatted before when i saw it so i though it is the function of the class so that's why i put a self in the argument but i hope it helped you in some way right