在MySQL中选择一个由PHP调用的两字字段名称 [英] Select a two-word field name in mySQL, called from PHP

查看:63
本文介绍了在MySQL中选择一个由PHP调用的两字字段名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图从字段中获取信息,但无法识别字段名称.

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());

感觉是因为字段名称"security name"是两个词.有没有办法传递两个字的字段名称,还是我必须更改所有内容以省略空格?

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 change everything to omit spaces?

推荐答案

在不符合标准的字段名称周围使用反引号:

Use backquotes around non-conformant field names:

`security name`

将来,仅使用一致的字段名称.

And in the future, only use conformant field names.

这篇关于在MySQL中选择一个由PHP调用的两字字段名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆