I just created a new table and had some fields like:
user-name
user-pass
I tried to do an insert doing something like insrt into myTable (user-name,user-pass) values ('bob','bobby')
and it no likey.
I guess I could have tried to escape the "-"'s with "\" but figured that would cause a major headache down the road.
As soon as I replaced all of the "-" with "_" I"m good to go.
This is news to me that I can't use these..can anyone shed some light here?
thx,
Burr
I can no usey "-" in my field names???
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
they are allowed, however, because - is a math operation by default.. you need to tell mysql that the field name is, in fact a name, and not a math operation of subtracting pass from user, or name from user:
note: the period after the insert should be removed, the server denies the posting otherwise.. 
note: those are backticks, the quote character on the tilde key (~) not single quotes:
` vs. '
Code: Select all
INSERT. INTO `myTable` (`user-name`,`user-pass`) VALUES('bob','bobby')note: those are backticks, the quote character on the tilde key (~) not single quotes:
` vs. '