Jump to content

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` )

)

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.