• Hi Guys,

    I am trying to link a foreign key to the wp_users ID column but mysql keeps telling me that I am using the wrong syntax between ‘REFERENCES wp_users(ID)’

    Table below:

    CREATE TABLE my_comments (
    comment_id integer auto_increment NOT NULL,
    comment_target_id integer NOT NULL,
    comment_target_tablename varchar(120) NOT NULL,
    comment_author varchar(120) NOT NULL,
    comment_date date NOT NULL,
    comment_content text NOT NULL,
    comment_approved tinyint(1) NOT NULL,
    comment_author_ip_address varchar(30) NOT NULL,
    user_id integer NOT NULL,
    PRIMARY KEY(comment_id),
    FOREIGN KEY user_id REFERENCES wp_users(ID)
    );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Referencing wp_users’ is closed to new replies.