PHP MySQL INSERT INTO解析错误

标签 php mysql sql joomla

我有一个有趣的任务是将 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 数据。

如果有人能提供帮助,我会很高兴。这很可能是眼睛疲劳的错误,对此深表歉意:)

最佳答案

fulltextreserved word在 MySQL 中。使用反引号对其进行转义或使用其他名称。

INSERT INTO nlqov_content (..., `fulltext`, ... 

关于PHP MySQL INSERT INTO解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23629105/

相关文章:

mysql - 在 Access/MySQL 中格式化小数位

mysql - 将频率表转换为 mySQL 中的时间 TableView

Mysql数据库选择关系

javascript - 客户端和服务器端编程有什么区别?

php - 成功后立即需要 INSERT 时,PHP 是否应该在 MySql Insert 之后休眠?

php - Bootstrap 模态表单提交不起作用

mysql - 所有类型的 SQL 连接的解释

sql - 如何在不使用500,000+行表中的截断表的同时有效地删除行

php - SilverStripe - 自定义分面搜索导航

php - 为什么 update 或 save() 在 laravel 5.8 中不起作用?