@vestal nymph posted:
I'd appreciate any help anyone can give. I don't know if I'm being stupid and missing some setting, or something.
So I have a Python Discord bot that I'm hosting on Pebblehost, and I'm using the free SQL database that comes with it. The database has a table to store birthdays in it. A user can send a command and the bot should add their birthday to the table. If the user's ID already exists in the table, then it just updates the values in the table.
This is the bit of code that adds a new birthday row to the table:
cursor = db_connection.cursor()
cursor.execute(f"insert into db_birthday values ({bday_user.id}, {month.value}, '{month.name}', {day}, '{timezone}', 0)")
cursor.close()
db_connection.commit
db_connection.close```
The bit of code that updates an existing row in the table is the exact same as above, except for the `cursor.execute` line, which is.
```cursor.execute(f"update db_birthday set birthday_month = {month.value}, birthday_monthname = '{month.name}', birthday_day = {day}, birthday_timezone = '{timezone}' where user_id = {bday_user.id}")```
The issue I am having is that my `update` statement works, but my `insert` statement doesn't, in my bot code. If I go directly to the server admin site through https://sqladmin.pebblehost.com/, I can run SQL code in the editor and insert new rows into my tables with no issue. But if I try to insert rows through a bot, it just does not work. It doesn't even give out an error either. The code acts like it's worked but it doesn't. I have no idea what to do. I suspect it is a permissions issue? I tried looking through the various options/settings in the server admin site, but couldn't find anything. Does anyone know what to do?