Answer the question
In order to leave comments, you need to log in
What is the error when entering data into the database?
Hello.
I can't figure out what's wrong?
Here is the code:
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\Desktop\New Folder (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\Desktop \New folder (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'")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question