@MadHowradBot

В чём ошибка при заносе данных в бд?

Всем привет.
Не могу понять в чём ошибка?
Вот код:
if reg == 0:
        bot.send_message(chatId,'Привет\nПока')
        bot.send_message(chatId,'0')
        insert_query = f"INSERT INTO `users` (idChat,username,promocodeh) VALUES({chatId}, {message.from_user.username}, 0);"
        cur.execute(insert_query)
        connection.commit()

А вот ошибка:
Traceback (most recent call last):
File "C:\Users\tereh\OneDrive\Рабочий стол\Новая папка (3)\main.py", line 44, in
bot.polling()
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 617, in polling
self.__threaded_polling(none_stop, interval, timeout, long_polling_timeout, allowed_updates)
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 676, in __threaded_polling
raise e
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 639, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\util.py", line 130, in raise_exceptions
raise self.exception_info
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\util.py", line 82, in run
task(*args, **kwargs)
File "C:\Users\tereh\OneDrive\Рабочий стол\Новая папка (3)\main.py", line 32, in start
cur.execute(insert_query)
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
result.read()
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
packet.raise_for_error()
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "C:\Users\tereh\AppData\Local\Programs\Python\Python39\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'madhowrad' in 'field list'")
  • Вопрос задан
  • 84 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы