简体   繁体   English

sql全文返回空

[英]sql fulltext returning null

I'm using the joomla CMS to write to my db and have written a custom front end. 我正在使用joomla CMS写入数据库,并编写了一个自定义前端。

I'm trying to obtain the contents of the 'fulltext' row. 我正在尝试获取“全文”行的内容。 I've tried mysql_fetch_assoc['fulltext'] and mysql_result($sql, 0, 'fulltext') . 我已经尝试了mysql_fetch_assoc['fulltext']mysql_result($sql, 0, 'fulltext') Both return fulltext . 两者都返回全文 Here's the query string: 这是查询字符串:

SELECT created, modified, title, introtext, 'fulltext', state, urls, created_by
  FROM table_content
 WHERE id='$id'

It's probably something really obvious I've missed because fulltext seems to conflict with sql without the quotation marks around it. 我可能想念的东西真的很明显,因为全文似乎与sql冲突,但不带引号。

Any assistance would as always be appreciated! 任何帮助将一如既往地感谢!

You can use SQL keywords as field names, with appropriate escaping with backticks. 您可以将SQL关键字用作字段名称,并使用反引号进行适当的转义。 You're using single quotes, which turns the word into a string that contains the word "fulltext". 您正在使用单引号,这会将单词转换为包含单词“全文”的字符串。

Try 尝试

SELECT .... introtext, `fulltext`, state, ...
                       ^--------^--- backticks

instead. 代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM