I am trying to make a table that logs the amount of times a player has logged in, by UUID and number of joins.
Here is what my table looks like (for testing)
I would like to make my program check if the UUID is already in the database, and then add 1 to the number of joins.
import sqlite3
connection = sqlite3.connect("joins.db")
cursor = connection.cursor()
try:
cursor.execute("CREATE TABLE joinsdatabase (uuid TEXT, joins INTEGER)")
except:
print("Table exists: Not creating a new one!")
def addP(player_uuid):
rows = cursor.execute("SELECT uuid, joins FROM joinsdatabase").fetchall()
cursor.execute("INSERT INTO joinsdatabase VALUES ('"+player_uuid+"', 1)")
connection.commit()