homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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 ( ` ).

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved