Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs

How To Use Repl's Database

Michael8910 has its own way of saving information called Repl Database. It is very easy to use and is great for making Log In Systems. In this tutorial, you will learn how to use repl's database by making a login system.

Before you can start using its functionality you will need to import it. You can do that by putting in

from replit import db

this will then install the database into your code.

The next thing you would want to do is create an area yourself where the user will be able to type in what they want their username or nickname to be. Have an input variable for what they decide to use. Next, you will need to add that input variable to the DB.

username = input()

Now, let's add a value that we want to save to this user.

value = input()
db["username"] = "value"

You can make the value anything you want. It could be money, coins, XP, etc. As you can see that when we set the keys they are the same as the input names.

Now that we have a way of creating an account now let's be able to log in.

LogUser = input()
GetValue = db["LogUser"]

Now we have a way of getting the user's value. You can implement this however you would like.

2 years ago
You are viewing a single comment. View All

ok ill make that change

2 years ago