H
H
happyjuic2022-03-27 10:02:06
Python
happyjuic, 2022-03-27 10:02:06

How to update value in sqlte table?

The console swears only at this function:
(Yes, the code is written collectively, but it's easier for me)

@bot.command()
async def путешествие(ctx):
  author = ctx.message.author
  a = author.id
  ran = random.randint(1, 1)
  xp = c.execute('SELECT xp FROM test WHERE login == ?', (a,)).fetchone()
  if ran == 1:
    ranxp = random.randint(1, 3)
    await ctx.send(random.choice(randomadvent))
    await ctx.send('Получен опыт: ' + str(ranxp))
    updatexp = xp + ranxp
    c.execute('UPDATE test SET xp == ? WHERE login == ?', (updatexp, a))
    sql.commit()


Ps the error is somewhere on the last 3 lines. It seems to be correct though...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question