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. Link to comment https://forums.phpfreaks.com/topic/30084-as-from/ 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. Link to comment https://forums.phpfreaks.com/topic/30084-as-from/#findComment-138308 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. Link to comment https://forums.phpfreaks.com/topic/30084-as-from/#findComment-142081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.