Jump to content

[SOLVED] CREATE TABLE error... cant find it


clown[NOR]

Recommended Posts

well... as it said in the topic... there's an error somewhere in y CREATE TABLE... but I've been looking trough those same 9-10 lines now for about 45 minutes and I cant figure it out...

 

I'll start off with the error message:

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 'release VARCHAR(30) NOT NULL, keywords VARCHAR(100) NOT NULL, rating INT' at line 6

 

Now over to the code:

	$query = "
	CREATE TABLE movies (
		id INT(6) NOT NULL auto_increment,
		title VARCHAR(30) NOT NULL,
		age INT(2) NOT NULL,
		genre VARCHAR(20) NOT NULL,
		release VARCHAR(30) NOT NULL,
		keywords VARCHAR(100) NOT NULL,
		rating INT(2) NOT NULL,
		review VARCHAR(1000) NOT NULL,
		image VARCHAR(30) NOT NULL
	)
";

 

it's built up exactly the same way as I've used on my other to MySQL projects... so I dont understand why this one is messing it up for me

 

TIA

 

Regards, Clown

Link to comment
https://forums.phpfreaks.com/topic/46533-solved-create-table-error-cant-find-it/
Share on other sites

Release is a MySQL keyword I believe.  Try this:

	$query = "
	CREATE TABLE movies (
		`id` INT(6) NOT NULL auto_increment,
		`title` VARCHAR(30) NOT NULL,
		`age` INT(2) NOT NULL,
		`genre` VARCHAR(20) NOT NULL,
		`release` VARCHAR(30) NOT NULL,
		`keywords` VARCHAR(100) NOT NULL,
		`rating` INT(2) NOT NULL,
		`review` VARCHAR(1000) NOT NULL,
		`image` VARCHAR(30) NOT NULL
	)
";

CREATE TABLE movies(

`id` INT( 6 ) NOT NULL AUTO_INCREMENT ,

`title` VARCHAR( 30 ) NOT NULL ,

`age` INT( 2 ) NOT NULL ,

`genre` VARCHAR( 20 ) NOT NULL ,

`release` VARCHAR( 30 ) NOT NULL ,

`keywords` VARCHAR( 100 ) NOT NULL ,

`rating` INT( 2 ) NOT NULL ,

`review` VARCHAR( 255 ) NOT NULL ,

`image` VARCHAR( 30 ) NOT NULL ,

PRIMARY KEY ( `id` ) )

 

---------------------------------------

CREATE TABLE movies(

`id` INT( 6 ) NOT NULL AUTO_INCREMENT ,

`title` VARCHAR( 30 ) NOT NULL ,

`age` INT( 2 ) NOT NULL ,

`genre` VARCHAR( 20 ) NOT NULL ,

`release` VARCHAR( 30 ) NOT NULL ,

`keywords` VARCHAR( 100 ) NOT NULL ,

`rating` INT( 2 ) NOT NULL ,

`review` TEXT NOT NULL ,

`image` VARCHAR( 30 ) NOT NULL ,

PRIMARY KEY ( `id` )

)

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.