开发者

Select a two-word field name in mySQL, called from PHP

开发者 https://www.devze.com 2022-12-16 10:33 出处:网络
trying to get information from a field and it\'s not recognizing the field name. $selectsecurityname = mysql_query(\"SELECT security name FROM securityinfo\") or die(mysql_error());

trying to get information from a field and it's not recognizing the field name.

$selectsecurityname = mysql_query("SELECT security name FROM securityinfo") or die(mysql_error());

Have a feeling it's because the fields name "security name" is two words. Is there a way to pass a two-word field name, or do I have to开发者_Go百科 change everything to omit spaces?


Use backquotes around non-conformant field names:

`security name`

And in the future, only use conformant field names.


Try it with backticks (key next to the left of the "1" ):

$selectsecurityname = mysql_query("SELECT `security name` FROM securityinfo") or die(mysql_error());
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号