Re: [Tutor] This should be easy

2005-07-19 Thread Michael Dunn
I'm not sure why your first example worked: Table is a reserved word
in SQL (i.e. it's used as a SQL command), so you shouldn't use it as a
table name. Imagine a poor dumb computer trying to parse create table
table...

Cheers, Michael
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] This should be easy

2005-07-18 Thread nephish
Hey there,

i have a script that i am trying to use to add a record to a MySQL
database.

i keep getting a syntax error.

this works
cursor.execute(INSERT INTO Table ( numberone ) VALUES ( 'one');)

but this does not
cursor.execute(INSERT INTO Table ( numberone, numbertwo ) VALUES
( 'one','two');)

what is getting scrambled here?

the error i get is syntax error in MySQL query, check the documentation,
blah blah blah

thanks


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] This should be easy

2005-07-18 Thread Alberto Troiano
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 [EMAIL PROTECTED]
To: tutor@python.org
Subject: [Tutor] This should be easy
Date: Mon, 18 Jul 2005 20:02:38 +

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@python.org
http://mail.python.org/mailman/listinfo/tutor


Gaucho


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] This should be easy

2005-07-18 Thread Pujo Aji
the code looks ok for me,

Can you post more specific, including the error ?

pujo

On 7/18/05, nephish [EMAIL PROTECTED] wrote:
 Hey there,
 
 i have a script that i am trying to use to add a record to a MySQL
 database.
 
 i keep getting a syntax error.
 
 this works
 cursor.execute(INSERT INTO Table ( numberone ) VALUES ( 'one');)
 
 but this does not
 cursor.execute(INSERT INTO Table ( numberone, numbertwo ) VALUES
 ( 'one','two');)
 
 what is getting scrambled here?
 
 the error i get is syntax error in MySQL query, check the documentation,
 blah blah blah
 
 thanks
 
 
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] This should be easy

2005-07-18 Thread Alberto Troiano
Hey

Your problem is in the database
I'm surprised how MySQL let you put a space in a field
In MySQL you can't have spaces, as far as I know
Try renaming the field by enteriig to the console and making the alter table 
sentence and put Site_Name instead of Site Name. Then make the query again 
and see what happens

mysql create table d(autoinc int(4) primary key,Site Name varchar(30));
ERROR 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 varchar(30))'

This is the error I get from MySQL Server when I try to create a field with 
a space and check the solution:
mysql create table d(autoinc int(4) primary key,Site_Name varchar(30));
Query OK, 0 rows affected (0.14 sec)

This should fix your problem.

Best Regards to you

Alberto

From: nephish [EMAIL PROTECTED]
To: Alberto Troiano [EMAIL PROTECTED]
CC: tutor@python.org
Subject: Re: [Tutor] This should be easy
Date: Mon, 18 Jul 2005 20:32:55 +

ok here is what i have,
cursor.execute(INSERT INTO History (autoinc, Site Name) VALUES
(12, '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 (12,
'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 (12);)

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 [EMAIL PROTECTED]
  To: tutor@python.org
  Subject: [Tutor] This should be easy
  Date: Mon, 18 Jul 2005 20:02:38 +
 
  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@python.org
  http://mail.python.org/mailman/listinfo/tutor
 
 
  Gaucho
 
 
 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Gaucho


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] This should be easy

2005-07-18 Thread nephish
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@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] This should be easy

2005-07-18 Thread nephish
Hey! looks like that is what the problem was.
i used the MySQL Migration toolkit to transfer all the records
over from Access to MySQL.
man, you really saved me a lot of time and frustration.
should have written in about 6 hours ago
thank you very much.


On 07/18/2005 03:41:59 PM, Alberto Troiano wrote:
 Hey
 
 Your problem is in the database
 I'm surprised how MySQL let you put a space in a field
 In MySQL you can't have spaces, as far as I know
 Try renaming the field by enteriig to the console and making the  
 alter table sentence and put Site_Name instead of Site Name. Then  
 make the query again and see what happens
 
 mysql create table d(autoinc int(4) primary key,Site Name  
 varchar(30));
 ERROR 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 varchar(30))'
 
 This is the error I get from MySQL Server when I try to create a  
 field with a space and check the solution:
 mysql create table d(autoinc int(4) primary key,Site_Name  
 varchar(30));
 Query OK, 0 rows affected (0.14 sec)
 
 This should fix your problem.
 
 Best Regards to you
 
 Alberto
 
 From: nephish [EMAIL PROTECTED]
 To: Alberto Troiano [EMAIL PROTECTED]
 CC: tutor@python.org
 Subject: Re: [Tutor] This should be easy
 Date: Mon, 18 Jul 2005 20:32:55 +
 
 ok here is what i have,
 cursor.execute(INSERT INTO History (autoinc, Site Name) VALUES
 (12, '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  
 (12,
 '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 (12);)
 
 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 [EMAIL PROTECTED]
  To: tutor@python.org
  Subject: [Tutor] This should be easy
  Date: Mon, 18 Jul 2005 20:02:38 +
 
  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@python.org
  http://mail.python.org/mailman/listinfo/tutor
 
 
  Gaucho
 
 
 
 
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
 
 
 Gaucho
 
 
 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor