Help with replDB again
So, I want to check if no two users on my flask site have the same referenceid, and a users db is
user = ["refId", "xp"], and the user chooses their own referenceid when signing up... How would I get it to check the refId of all the other existing users?
I would do something like this:
from replit import db keys = db.keys() all_id =  for key in keys: all_id.append(db[key]["refId"])
But that only works if you are saving the data in a dictionary, if you let me see your code I can probably figure out a better solution.
You could technically set up an SQLite file for that to store the data, and link it to your repl. Or you could create a new file with all the referenceid as a list.
@MathBoy1 Yes, but since I am not such an expert, you might want to ask someone else. Sorry, but replDB and flask are not things I usually program in. :-( I'll try to research it though, maybe go to replit docs.
@MathBoy1 Ah! Eureka! https://docs.replit.com/tutorials/11-using-the-replit-database
Forget everything I wrote earlier. Only reference the link above.
To find out if someone else already has the refId, then you should make a variable first called refId then do something like:
if refId in db.keys():
print("refId already exists")
Again, look through the repl docs link that I posted above.
The power of the docs!