Taux1c
Taux1c

Reputation: 65

This script will not insert text into my database

I have this script ( below ) that will not insert text into my database no matter what I do. I can print it and then copy & paste into mysql and it works fine. Other scripts execute and store just fine. Any ideas?

    @client.command(pass_context=True)
async def addrule(ctx,*,rule):
    g=str(ctx.guild).replace(' ','_')
    sqluse(g)
    x="INSERT INTO rules (rule) VALUES (\"%s\")"
    val=(rule)
    mycursor.execute(x % val)

Upvotes: 0

Views: 41

Answers (1)

chluebi
chluebi

Reputation: 1829

Always remember to save changes to your database via

mydb.commit()

after doing permanent changes.

Upvotes: 1

Related Questions