fulltext
is a reserved word in MySQL. Either use backticks to escape it or use another name.
INSERT INTO nlqov_content (..., `fulltext`, ...
Вопрос
I have a funny assignment of moving Joomla 1.0 content to Joomla 3.2 content. I wrote a few scripts for categories, worked fine. Now I am working on porting script for articles and I keep getting an error in this MySQL query:
$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, '*', '' )
Which errors with:
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
I can't find out what is wrong with that query. I checked data types, they are fine.
I ommited some JSON data for code to be clearer.
I'll be glad if anybody can help. This may very well be an error of tired eyes, so sorry for that :)
Решение
fulltext
is a reserved word in MySQL. Either use backticks to escape it or use another name.
INSERT INTO nlqov_content (..., `fulltext`, ...
Другие советы
fulltext is mysql keyword use back tits like this
$qr = "INSERT INTO nlqov_content
(`id`, `asset_id`, `title`,`alias`, `introtext`, `fulltext`,....)