If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > DB Error: syntax error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-03-11, 18:54
stevestark5000 stevestark5000 is offline
Registered User
 
Join Date: Jan 2011
Posts: 1
DB Error: syntax error

I am using php5 and i am getting a create table error. the code works in php4 but i need it to work in php5. i don't even know where the error is. can i get some examples please.

DB Error: syntax error
CREATE TABLE mod_scheduler_entries ( id int(11) unsigned NOT NULL default '0', owner varchar(20) default NULL, editor varchar(20) default NULL, ip text, created int(11) default NULL, updated int(11) default NULL, hidden smallint(1) NOT NULL default '0', start int(11) default NULL, end int(11) default NULL, label text, user int(11) default NULL, global smallint(1) default NULL, administrative smallint(1) default NULL, repeat smallint(1) default NULL, repeat_until int(11) default NULL, mode int(2) default NULL, properties varchar(255) default NULL, pid int(11) default NULL, PRIMARY KEY (id))

[nativecode=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 'repeat smallint(1) default NULL, repeat_until int(11) default NULL, mode int' at line 1]



here is the file that gives the error
CREATE TABLE mod_scheduler_entries (
id int(11) unsigned NOT NULL default '0',
owner varchar(20) default NULL,
editor varchar(20) default NULL,
ip text,
created int(11) default NULL,
updated int(11) default NULL,
hidden smallint(1) NOT NULL default '0',
start int(11) default NULL,
end int(11) default NULL,
label text,
user int(11) default NULL,
global smallint(1) default NULL,
administrative smallint(1) default NULL,
repeat smallint(1) default NULL,
repeat_until int(11) default NULL,
mode int(2) default NULL,
properties varchar(255) default NULL,
pid int(11) default NULL,
PRIMARY KEY (id)
);

solved: the word 'repeat' is a reserved word

Last edited by stevestark5000; 01-03-11 at 19:42. Reason: solved
Reply With Quote
  #2 (permalink)  
Old 01-04-11, 07:03
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
Unfortunately the word REPEAT is a reserved word in MySQL. If you want to really use this as the field name then enclose it in `repeat`. I have put together a list of the reserved words in MySQL 5.1 MySQL – 5.1 Reserved Words « IT Integrated Business Solutions
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On