discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax error

Question:

when I’m trying to remove specific things from my Database (sqlite3) it’s giving me error: discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax error for some reasons, here’s the needed code:

c.execute("DELETE FROM accounts WHERE email=?, password=?", (newresults[0], newresults[1]))

By the way, the values newresults[0] and newresults[1] are defined in the main code.

and heres the full traceback:

Ignoring exception in command buy:
Traceback (most recent call last):
File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 127, in wrapped
    ret = await coro(arg)
  File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 911, in _invoke
    await self.callback(ctx, **kwargs)
  File "C:UsersuserDesktopSidthomain.py", line 62, in buy
    c.execute("DELETE FROM accounts WHERE email=?, password=?", (newresults[0], newresults[1]))
sqlite3.OperationalError: near ",": syntax error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordbot.py", line 1008, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 359, in invoke
    await injected(ctx)
  File "C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagesdiscordcommandscore.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: OperationalError: near ",": syntax error
Asked By: SIDALonpy

||

Answers:

You need to use AND so:

"DELETE FROM accounts WHERE email=? AND password=?"
Answered By: PChemGuy
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.