sylesia Posted December 10, 2006 Share Posted December 10, 2006 Ok, running a program where I am trying to access my DB. Problem is one of the column names is actually AS, so when I run my select line[code]SELECT $try FROM table WHERE userName ' $userName'[/code]and $try later ends up as AS, it becomes AS FROM, which is not valid. Whats the proper way of doing this? I cannot do '$try' as it gives me literal values and does not actually ever pull anything out of the DB. Quote Link to comment Share on other sites More sharing options...
AndyB Posted December 10, 2006 Share Posted December 10, 2006 AS is a [b]reserved[/b] word with MySQL - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.htmlDon't use reserved words for table or field names. Quote Link to comment Share on other sites More sharing options...
fenway Posted December 15, 2006 Share Posted December 15, 2006 [quote author=AndyB link=topic=118026.msg481949#msg481949 date=1165720570]AS is a [b]reserved[/b] word with MySQL - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.htmlDon't use reserved words for table or field names.[/quote]Backticks are always an option if you have no way to change the column name. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.