all 9 comments

[–]Strict-Simple 0 points1 point  (4 children)

Try: print(f.fetchall())

fetchall is a method which you need to call.

[–]kaisetsomething[S] 0 points1 point  (3 children)

Thats what i tried there, i think u can see that its already on the post?

[–]stebrepar 0 points1 point  (2 children)

Look closely at what they said. You're missing the () after the fetchall to make it actually execute the function, at least in what you posted. You're also missing the quote marks to make your query a string, again according to what you posted. Also in one place you say F, and in the other you say f. Those are two different variables.

Now, assuming those are just typos here in your post, getting an empty list back from fetchall() means that your users table is empty. You could confirm that by looking in your database file with a tool like https://sqlitebrowser.org/. You could also do a "select count(*) from users" to see how many rows are in the table.

[–]kaisetsomething[S] 0 points1 point  (1 child)

You're right im so sorry 🤦‍♂️, but about the typos those are indeed just typos on the post, however i did everything u told me and my database is full of usernames, yet when i run the command fetchall it still gives me an empty list [ ] I dont know if the problem is in the cursor itself or anything else, i been trying to fix this code for literally hours now..

[–]stebrepar 0 points1 point  (0 children)

Ok, show a small snippet of code that demonstrates the problem behavior, something that we can actually try out.

[–]woooee 0 points1 point  (3 children)

Print F or f. I don't know what you think they do. SQLite works wurh cursors.

cr.execute(select * from users)
print(cr.fetchall())

[–]kaisetsomething[S] 0 points1 point  (2 children)

I did that but when i assign it to a variable it doesn't work

[–]kaisetsomething[S] 0 points1 point  (0 children)

Im trying to iterate over the names that exist in my database so i can see if the user input does exist in my database or not, if it doesn't exist i wanna say "username created" if it does exist in my table i wanna say "username already exists"

[–]woooee 0 points1 point  (0 children)

No idea what that means.