Syntax Error Near FIELD

MySQL retourneerde:

#1064 - 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 ‘fields text default ‘’,
fil’ at line 7

SQL-query:


CREATE TABLE IF NOT EXISTS `wp_multifeed` (

id int( 11 ) NOT NULL AUTO_INCREMENT ,
title varchar( 255 ) default '',
FILE varchar( 255 ) default '',
FIELDS text default '',
file_lines int( 15 ) default '0',
post_content text,
post_title text,
tags text,
categories text,
remove int( 2 ) default '0',
isunique varchar( 50 ) default '',
one varchar( 10 ) default '',
custom_names text,
custom_values text,
chkshed smallint( 2 ) default '0',
noofposts int( 10 ) default '0',
post_int int( 10 ) default '0',
comment_status smallint( 2 ) default '0',
ping_status smallint( 2 ) default '0',
usecondition varchar( 10 ) default '',
localfile text,
url text default '',
file_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ,
advanced varchar( 10 ) default '',
START varchar( 10 ) default '',
finish varchar( 10 ) default '',
slt_intrtype varchar( 10 ) default '',
post_ids text,
del_old int( 1 ) ,
PRIMARY KEY ( id ) )

FIELDS is a reserved word, either rename the column or put backticks around it

thank you verry much

Hi all

I have a Wordpress plugin that creates a table, some people have reported that this does not get created. When I have asked then to run the definition in manually they get errors, when I do it, it creates the table correctly without any problems.

The reported error is:

#1064 - 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
‘fields text,
file_lines int(15) default ‘0’,
post_content text,
post_ti’ at line 5

I did not think that the table was doing anything out of the ordinary so if anyone can help I would appreciate it.

The table is as follows:


CREATE TABLE wp_multifeed (
id int(11) NOT NULL auto_increment,
title varchar(255) default '',
file varchar(255) default '',
fields text,
file_lines int(15) default '0',
post_content text,
post_title text,
tags text,
categories text,
remove int(2) default '0',
isunique varchar(50) default '',
one varchar(10) default '',
custom_names text,
custom_values text,
chkshed smallint(2) default '0',
noofposts int(10) default '0',
post_int int(10) default '0',
comment_status smallint(2) default '0',
ping_status smallint(2) default '0',
condition1 varchar(10) default '',
condition1value varchar(255) default '',
condition1type varchar(64) default '',
condition2 varchar(10) default '',
condition2value varchar(255) default '',
condition2type varchar(64) default '',
usecondition varchar(10) default '',
localfile text,
url text,
file_date timestamp NOT NULL default CURRENT_TIMESTAMP,
advanced varchar(10) default '',
start varchar(10) default '',
finish varchar(10) default '',
slt_intrtype varchar(10) default '',
PRIMARY KEY (id)
) AUTO_INCREMENT=3;

Thanks

Matt Houldsworth
Digitalquill

FIELDS is a reserved word, either rename the column or put backticks around it

:slight_smile:

can you give a example modify code i am a noob thanks

what do you mean by “modify code” ?

Hi ericeric29, welcome to the forums.

I’ve put your code inside MySQL bbtags. Please notice the differences in color.

See how FIELDS looks? You can’t use that for a name or you’ll get syntax errors.

And using lowercase instead and removing the DEFAULT isn’t not using it. See how the bbCode “fixed” it by changing it to uppercase? That’s because it’s a reserved word. Reserved meaning it’s “already taken” and has “special significance”.

You can modify it to whatever you like, eg. myfields, hisfields, herfields, foofields, etc. etc. but it can’t be fields.

WordPress can be quite involved even for an experienced developer. So perhaps you should put this aside (or at least not release it) until you’re not a “noob”.

Nothing personal, but as WordPress doesn’t test plugins before they host them on the repository, you really shouldn’t release a plugin until you better know what you’re doing.

((; this plugin i buy from http://www.digitalquill.co.uk/datafeedplugin/

but seems not to work for me
it dont can create a table

i am a user noob i was thinking software i pay for is better ((;

Well, if you paid for it, the author should provide support no?

If not one-to-one support, maybe there’s a support forum for plugin users? Or a support wiki? I wouldn’t suggest hacking the code, you stand a good chance of making things worse, and when you do get support, having made your own changes is likely to upset the author.

I don’t know how much you paid for it, but IMHO it’s better to use free open-source plugins that are hosted on the wordpress.org repository.

EDIT: I went to the

broken plugin: WordPress Datafeed Plugin

site and there is a wiki, have you tried that.

IMHO the

Wordpress Datafeed plugin is too expensive

for something that doesn’t work.