我有一个有趣的任务是将 Joomla 1.0 内容移动到 Joomla 3.2 内容。我为类别写了一些脚本,效果很好。现在我正在为文章编写移植脚本,但我一直在这个 MySQL 查询中遇到错误:
$qr = "INSERT INTO nlqov_content
(id, asset_id, title, alias, introtext, fulltext, state, catid,
created, created_by, created_by_alias, modified, modified_by,
checked_out, checked_out_time, publish_up, publish_down, images,
urls, attribs, version, ordering, metakey, metadesc, access,
hits, metadata, featured, language, xreference
)
VALUES
(7,125,'Welcome to Joomla!','welcome-to-joomla','', '', 0, 61, '2004-06-12 11:54:06',
62, 'Web Master', '2004-06-12 12:33:27',62,0, '0000-00-00 00:00:00', '2004-01-01 00:00:00',
'0000-00-00 00:00:00', '{"image_intro":""}', '{"urla":false}','{"show_title":""}',
1, 1, '', '', 1, 10, '{"robots":"","author":"","rights":"","xreference":""}', 0, '*', '' )
哪些错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fulltext, state, catid, created, cr' at line 1 - error_num: 1064
我无法找出该查询有什么问题。我检查了数据类型,它们没问题。
为了代码更清晰,我省略了一些 JSON 数据。
如果有人能提供帮助,我会很高兴。这很可能是眼睛疲劳的错误,对此深表歉意:)
最佳答案
fulltext
是 reserved word在 MySQL 中。使用反引号对其进行转义或使用其他名称。
INSERT INTO nlqov_content (..., `fulltext`, ...
关于PHP MySQL INSERT INTO解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23629105/