Development Tools Using PHP with MySQL Connecting PHP to MySQL Creating the Products Table

CREATE is not valid in this position

Hi, I am trying to set up my data base. However after creating the data base and trying to create a new table table. I keep getting a syntax error that CREATE is not valid in this position.

I have ran USE 'mytablename' so I know it is created. I have added a create to make sure the table I am about to create does not exist. I have even check the sql syntax for MYSQL 5 which says I am creating the new table the correct way but I can't get my line to run.

2 Answers

I am sorry but I have ran out of my psychic juice for today.. could you please let me know what QUERY you are trying to do?

usually you do not do use tablename.. you do USE DATABASE_NAME then you do something like:

Create table_name (
     id   int(20) NOT NULL,
     name varchar2(200) NOT NULL,
     address varchar2(255) NOT NULL
);

Im sorry. I made a mistake. I run USE database_name, its highlights the correct schema in mysql workbench. If I then try to copy and paste the same line of code you mention. I get the error I mention above.

I was using the wrong key words for the MY SQL Server edition, for 5.5 CREATE TABLE table_name is required.