Jump to content
Larry Ullman's Book Forums

Recommended Posts

My table structure is:

ID int(11)

ClientID int(11)

ProgramType int(11)

When varchar(255)

Where varchar(255)

HowLong varchar(255)

 

The command is:

insert into tblRehabilitationHistory (ClientID, ProgramType, When, Where, HowLong) values ('2', '1', '2009', 'Brisbane', '6 weeks');

 

The error message is:

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 'When, Where, HowLong) values ('2', '1', '2009', 'Brisbane', '6 weeks')' at line 1

 

I am at a loss to see where I have gone wrong.

 

Any and all help will be appreciated.

Link to comment
Share on other sites

The ClientID, ProgramType are both numerical values so you don't need to quote them as you have done the string values. So you could try this:

 

insert into tblRehabilitationHistory (ClientID, ProgramType, When, Where, HowLong) values (2, 1, '2009', 'Brisbane', '6 weeks');

Link to comment
Share on other sites

Actually the backticks didn't make any difference but changing some of the field names did.

My table structure is: now

ID int(11)

ClientID int(11)

TypeOfProgram int(11)

WhenRun varchar(255)

WhereRun varchar(255)

HowLong varchar(255)

Thanks again for your help.

Link to comment
Share on other sites

 Share

×
×
  • Create New...