How to provide user id in mysql using Python

I want to search for a user in a table by the user id from discord, but I can't provide the id in mysql. I get an error You have an error in your SQL syntax; But I don't understand what's wrong.

    @commands.command()
    async def balance(self, ctx):
        create_balance(ctx)
        query = ("SELECT UserID FROM userdata "
                 "WHERE UserID = %s")

        user_id = ctx.message.author.id
        cur.execute(query, (user_id))
        for (UserID, score) in cur:
            print(UserID,score)


from Recent Questions - Stack Overflow https://ift.tt/3C0DMW3
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation