[Tutor] This should be easy

nephish nephish at xit.net
Mon Jul 18 22:32:55 CEST 2005


ok here is what i have,
cursor.execute("INSERT INTO History (autoinc, Site Name) VALUES  
(888812, 'Test');")

gives me this
''' _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 'Name) VALUES (888812,  
'Test')' at line 1") '''

the autoinc field isn't really an auto-increment field, its an int.  
That is left over from the migration from Access.

there are other fields in the table but all can be null.

this line works fine though
cursor.execute("INSERT INTO History (autoinc) VALUES (888812);")

this line does not
cursor.execute("INSERT INTO History (Site Name) VALUES ('test');")

can you not have spaces in a field name ? is the quotes gone awry?

dont know what to do next.
please help !

thanks




On 07/18/2005 03:06:34 PM, Alberto Troiano wrote:
> I think it would be better for us if you send us the entire line  
> that's giving you problems along with the error its givin you so we  
> can start somewhere
> 
> Right now I don't know where to look at
> 
> Best Regards
> 
> Alberto
> 
>> From: nephish <nephish at xit.net>
>> To: tutor at python.org
>> Subject: [Tutor] This should be easy
>> Date: Mon, 18 Jul 2005 20:02:38 +0000
>> 
>> ok here is the error i am getting.
>> You have an error in your SQL syntax. Check the manual that  
>> corrosponds
>> to your MySQL version for the right syntax near Name ) values ('one',
>> 'two')
>> 
>> thanks
>> 
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
> 
> 
> Gaucho
> 
> 
> 



More information about the Tutor mailing list