Форум сайта python.su
0
Есть бд ‘mydb’, таблица ‘mydb’, столбец ‘mydb’ тип text.
Пробую записать переменную:
import MySQLdb znachenie = "12345" MyDB=MySQLdb.connect(host='localhost', user='mydb', passwd='pass', db='mydb', charset='utf8') cursor = MyDB.cursor() cursor.execute(""" INSERT INTO mydb(mydb) VALUES (%s)""", (znachenie)) MyDB.commit() MyDB.close()
SHOW COLUMNS FROM [mydb]; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[mydb]' at line 1 mysql> SELECT * FROM [mydb]; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[mydb]' at line 1
Офлайн
61
при чем тут питон?
Офлайн
857
ss100sЭто не кортеж., (znachenie))
(znachenie,)
Офлайн