SQL syntax error

Soldato
Joined
1 Mar 2003
Posts
5,508
Location
Cotham, Bristol
What's wrong with this, I can't see it?

PHP:
self._cursor.execute("""INSERT INTO CHANNELPROGRAMME(CHANNELID,PROGRAMMEID,
                             EPISODEID,REPEAT,
                             NEWSERIES,PREMIERE,
                             CHOICE,SUBTITLES,
                             DEAFSIGNED,DATE,
                             STARTTIME,ENDTIME,DURATION) 
                             VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
                             (channelID,progId[0],epId,
                             tempDict["REPEAT"],tempDict["NEWSERIES"],
                             tempDict["PREMIERE"],tempDict["CHOICE"],
                             tempDict["SUBTITLES"],tempDict["DEAFSIGNED"],
                             formatDate,tempDict["STARTTIME"],
                             tempDict["ENDTIME"],tempDict["DURATION"]))

I keep getting the following error

_mysql_exceptions.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 'REPEAT,NEWSERIES,PREMIERE,CHOICE,\n SUBT' at line 1")
 
You probably need to put quotes around your parameters.

Try printing out the SQL (I assume you can switch self._cursor.execute to make it write out the SQL to screen instead) and manually running it in PHPMyAdmin etc to pinpoint the error, then come back and fix it in your code.
 
Back
Top Bottom