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
15

How To Use Repl's Database

Michael8910
Michael8910

Repl.it 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
1
bigboyyyyyyyy69
bigboyyyyyyyy69

@PrinceOfHeaven
I know this is a late response but I found this cool so I went ahead and made a SIMPLE example of this..
check it out here

2 years ago