Problem with an insert on MySQL-Python.
Hi! I'm working with MySQL on Python and I have a little problem with an insert statement and I don't understand where is the problem...
I have this table:
CREATE TABLE directory (
iddir INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
idfather INTEGER NOT NULL DEFAULT 0,
dname VARCHAR(128) NOT NULL,
PRIMARY KEY(iddir),
INDEX pare(idfather)
) TYPE=InnoDB;
And I'm trying to execute this query:
curs.execute('insert into directory(idfather,dname) values(2,/hi world)')
Of course, the directory number 2 does exist, but the IDLE prompt shows me the next message:
Traceback (most recent call last):
File "<pyshell#81>", line 1, in <module>
curs.execute(query)
File "C:\Python25\Lib\site-packages\MySQLdb\cursors.py", line 166, in execute
self.errorhandler(self, exc, value)
File "C:\Python25\Lib\site-packages\MySQLdb\connections.py", line 35, in defaulterrorhandler
raise errorclass, errorvalue
ProgrammingError: (1064, "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 '/hi world)' at line 1")
It seems that the program does not recognize the string/varchar value, but I don't know... I have already proved without the '/' character and without "gap" space and the problem still stays.
Can anybody help me?
THANKS!!