Results 1 to 3 of 3

Thread: #1064 - You have an error in your SQL syntax using near

  1. #1
    Join Date
    Mar 2010
    Posts
    18

    Default #1064 - You have an error in your SQL syntax using near

    Hi,

    I am having a problem using MYSQL query to add a table.

    I have two queries and below are the errors and query. I would appreciate any help.

    Thanks,

    Gibs

    Code:
    CREATE TABLE IF NOT EXISTS {$db_prefix}subscriptions(
    ID_SUBSCRIBE int(11) NOT NULL auto_increment,
    Name varchar(60) NOT NULL default '',
    Description tinytext NOT NULL,
    Cost text NOT NULL default '',
    Length varchar(6) NOT NULL default '',
    ID_GROUP int(8) NOT NULL default '0',
    addGroups varchar(40) NOT NULL default '',
    active tinyint(3) NOT NULL default '1',
    Repeatable tinyint(3) NOT NULL default '0',
    allowPartial tinyint(3) NOT NULL default '0',
    reminder tinyint(4) NOT NULL default '0',
    email_complete text NOT NULL default '',
    PRIMARY KEY  (ID_SUBSCRIBE),
    KEY active (active)
    ) TYPE=MyISAM
    
    #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 '{$db_prefix}subscriptions( ID_SUBSCRIBE int(11) NOT NULL auto_increment, Name ' at line 1
    
    ---------------------------------------------------
    
    
    CREATE TABLE IF NOT EXISTS {$db_prefix}log_subscribed(
    ID_SUBLOG int(10) NOT NULL auto_increment,
    ID_SUBSCRIBE int(10) NOT NULL default '0',
    ID_MEMBER int(10) NOT NULL default '0',
    OLD_ID_GROUP int(8) NOT NULL default '0',
    startTime int(10) NOT NULL default '0',
    endTime int(10) NOT NULL default '0',
    status tinyint(3) NOT NULL default '0',
    reminder_sent tinyint(3) NOT NULL default '0',
    vendor_ref tinytext NOT NULL default '',
    PRIMARY KEY  (ID_SUBLOG),
    UNIQUE KEY ID_SUBSCRIBE (ID_SUBSCRIBE,ID_MEMBER),
    KEY ID_USER (ID_MEMBER)
    ) TYPE=MyISAM
    
    
    #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 '{$db_prefix}log_subscribed( ID_SUBLOG int(10) NOT NULL auto_increment, ID_SUBS' at line 1

  2. #2
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    4,944

    Default

    At a guess you have the SQL inside single ' instead of double " so that {$db_prefix} isn't havint the value of the prefix field substituted.

  3. #3
    Join Date
    Mar 2010
    Posts
    18

    Default thanks

    Hi,

    Thanks for the reply. That didn't work either but racking my brain it was the variable "{$db_prefix}" that i needed to change to "smf_" the actual value of what the database prefix is.


    Thanks again for your help,

    Gibs

Posting Permissions

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