| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|Help me on Mysql|
| 6:31 pm on Jun 12, 2005 (gmt 0)|
I have this code,
INSERT INTO `newbus` ( 'busid' )
And i got this error message,
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 ''busid' ) VALUES (
)' at line 1
What seems to be the problem? Thanks
| 6:37 pm on Jun 12, 2005 (gmt 0)|
Try it without using quotes for table/column names:
INSERT INTO newbus (busid) VALUES ('3');
If busid is a numeric column, also remove the quotes from '3':
INSERT INTO newbus (busid) VALUES (3);
| 6:40 pm on Jun 12, 2005 (gmt 0)|
Have you tried to put a ; (semicolon) at thee end of the statement?
The way you do the statement (the pattern) is like this:
Insert into table_name
(columnName1, ColumnName2, ...)
Values (Value1, Value2, ...);
| 6:41 pm on Jun 12, 2005 (gmt 0)|
Your column names don't need to be quoted. If you want/need to quote the column names, use the back tick(`) instead.
INSERT INTO `newbus` ( busid )
INSERT INTO `newbus` ( `busid` )
| 2:10 am on Jun 13, 2005 (gmt 0)|
Thanks, now i know my mistake. My eyes are not realy good in differentiating ( ' ) and ( ` ).
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved