Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2011
    Posts
    1

    Unanswered: 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 20:42. Reason: solved

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    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
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •