我有一个有趣的任务,将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, '*', '' )
我找不出那个查询有什么问题。我检查了数据类型,它们都很好。你的SQL语法有错误;查看手册对应于MySQL服务器版本,以便使用正确的语法
为了让代码更清晰,我提交了一些JSON数据。
如果有人能帮忙,我会很高兴的。这很可能是眼睛疲劳造成的错误,很抱歉:)fulltext
是MySQL中的保留字。或者使用反号转义,或者使用另一个名称。
INSERT INTO nlqov_content (..., `fulltext`, ...
全文是mysql关键字的使用方式
$qr = "INSERT INTO nlqov_content
(`id`, `asset_id`, `title`,`alias`, `introtext`, `fulltext`,....)