Jump to content

As FROM


sylesia

Recommended Posts

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

[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.html

Don'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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.