Skip to content

Commit

Permalink
Update dbGenerator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
j0rd1s3rr4n0 committed May 14, 2023
1 parent 1b95b77 commit e7b10e5
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions dbGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,23 @@ def getPlaces():
conn.close()
return result


def updatePlaces(place, username):
conn = sqlite3.connect(database)
cursor = conn.cursor()
sql = f"SELECT asistentes FROM places where campo = '{place}';"
cursor.execute(sql)
asistents = cursor.fetchall()[0][0]
asistents+=(","+username)
sql = "UPDATE places SET asistentes = ? WHERE campo = ?;"
cursor.execute(sql, (asistents, place))
conn.commit()
conn.close()
try:
sql = f"SELECT asistentes FROM places where campo = '{place}';"
cursor.execute(sql)
asistents = cursor.fetchall()[0][0]
asistents+=(","+username)
sql = "UPDATE places SET asistentes = ? WHERE campo = ?;"
cursor.execute(sql, (asistents, place))
conn.commit()
except Exception as e:
print("Error updating place:", e)
finally:
conn.close()


def insertPlaces(place, username):
conn = sqlite3.connect(database)
Expand Down

0 comments on commit e7b10e5

Please sign in to comment.