dbTalk Databases Forums  

Re: silly mistake in the mysql part?

comp.databases.mysql comp.databases.mysql


Discuss Re: silly mistake in the mysql part? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Beauregard T. Shagnasty
 
Posts: n/a

Default Re: silly mistake in the mysql part? - 05-22-2011 , 07:23 PM






geoff (AT) invalid (DOT) invalid wrote:

Quote:
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 'order,correct_answer,score,delay) VALUES
('geoff','A001X001','C1',1,'1','6','4',' at line 1
Maybe "order" is a restricted keyword. My practice is to never use real
English words as fieldnames or variables. Try restructuring to use, say,
"order_1" instead and see what happens.

You might also wrap order in `` -- `order` -- but it is still a keyword,
which might give problems elsewhere.

Ah yes. "order" is listed here as a reserved keyword:
http://dev.mysql.com/doc/refman/5.0/...ved-words.html

--
-bts
-Four wheels carry the body; two wheels move the soul

Reply With Quote
  #2  
Old   
geoff@invalid.invalid
 
Posts: n/a

Default Re: silly mistake in the mysql part? - 05-23-2011 , 12:10 AM






On Sun, 22 May 2011 20:23:49 -0400, "Beauregard T. Shagnasty"
<a.nony.mous (AT) example (DOT) invalid> wrote:

Quote:
geoff (AT) invalid (DOT) invalid wrote:

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 'order,correct_answer,score,delay) VALUES
('geoff','A001X001','C1',1,'1','6','4',' at line 1

Maybe "order" is a restricted keyword. My practice is to never use real
English words as fieldnames or variables. Try restructuring to use, say,
"order_1" instead and see what happens.

You might also wrap order in `` -- `order` -- but it is still a keyword,
which might give problems elsewhere.

Ah yes. "order" is listed here as a reserved keyword:
http://dev.mysql.com/doc/refman/5.0/...ved-words.html
Bang on Beauregard !! Changed to a_order and all is well again.

Previously it was something like c1_order so the problem didn't arise.

Was it experience that told you that "order" might be the problem
being a restricted word? The error message doesn't give much of a
clue, does it?

Cheers

Geoff

Reply With Quote
  #3  
Old   
Beauregard T. Shagnasty
 
Posts: n/a

Default Re: silly mistake in the mysql part? - 05-23-2011 , 04:54 AM



geoff (AT) invalid (DOT) invalid wrote:

Quote:
"Beauregard T. Shagnasty" wrote:
geoff (AT) invalid (DOT) invalid wrote:
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 'order,correct_answer,score,delay) VALUES
('geoff','A001X001','C1',1,'1','6','4',' at line 1

Maybe "order" is a restricted keyword. My practice is to never use
real English words as fieldnames or variables. Try restructuring to
use, say, "order_1" instead and see what happens.

You might also wrap order in `` -- `order` -- but it is still a
keyword, which might give problems elsewhere.

Ah yes. "order" is listed here as a reserved keyword:
http://dev.mysql.com/doc/refman/5.0/...ved-words.html

Bang on Beauregard !! Changed to a_order and all is well again.
Previously it was something like c1_order so the problem didn't
arise.
What caused you to change it from c1_order to order?

Quote:
Was it experience that told you that "order" might be the problem
being a restricted [reserved] word? The error message doesn't give
much of a clue, does it?
Yes, experience. As I said, I don't use English words for fieldnames and
variables because I was bitten by the same problem (once) eons ago.
That's why I stopped using any form of a real word. Frequently, I
prepend a letter indicating the type of data: corder .. cfirstname ..
ddob .. ipkey .. bsubscribed .. where c=character, d=date, i=integer,
b=boolean etc.

"check the manual ... for the right syntax to use near 'order, "
was an instant clue to me. :-)

Note too that PHP also has its own list of reserved words.
http://www.php.net/manual/en/reserved.keywords.php

--
-bts
-Four wheels carry the body; two wheels move the soul

Reply With Quote
  #4  
Old   
geoff@invalid.invalid
 
Posts: n/a

Default Re: silly mistake in the mysql part? - 05-23-2011 , 12:06 PM



On Mon, 23 May 2011 05:54:39 -0400, "Beauregard T. Shagnasty"
<a.nony.mous (AT) example (DOT) invalid> wrote:

Quote:
geoff (AT) invalid (DOT) invalid wrote:

"Beauregard T. Shagnasty" wrote:
geoff (AT) invalid (DOT) invalid wrote:
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 'order,correct_answer,score,delay) VALUES
('geoff','A001X001','C1',1,'1','6','4',' at line 1

Maybe "order" is a restricted keyword. My practice is to never use
real English words as fieldnames or variables. Try restructuring to
use, say, "order_1" instead and see what happens.

You might also wrap order in `` -- `order` -- but it is still a
keyword, which might give problems elsewhere.

Ah yes. "order" is listed here as a reserved keyword:
http://dev.mysql.com/doc/refman/5.0/...ved-words.html

Bang on Beauregard !! Changed to a_order and all is well again.
Previously it was something like c1_order so the problem didn't
arise.

What caused you to change it from c1_order to order?
Beauregard

in my effort to improve the design of the database I have changed from
having 480 columns to having 10! This meant a change in field names.

Quote:
Was it experience that told you that "order" might be the problem
being a restricted [reserved] word? The error message doesn't give
much of a clue, does it?

Yes, experience. As I said, I don't use English words for fieldnames and
variables because I was bitten by the same problem (once) eons ago.
That's why I stopped using any form of a real word. Frequently, I
prepend a letter indicating the type of data: corder .. cfirstname ..
ddob .. ipkey .. bsubscribed .. where c=character, d=date, i=integer,
b=boolean etc.

"check the manual ... for the right syntax to use near 'order, "
was an instant clue to me. :-)
ah! hopefully I will recognise that next time!

Cheers

Geoff

Quote:
Note too that PHP also has its own list of reserved words.
http://www.php.net/manual/en/reserved.keywords.php

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.