Query error(phpmyAdmin form) mySQL, *nix

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Sky
Forum Commoner
Posts: 71
Joined: Wed Oct 02, 2002 4:00 pm

Query error(phpmyAdmin form) mySQL, *nix

Post by Sky »

Ok, I want to create a new table. I've tried variations of this query, and get various (but similar) errors. This last one was straight from the table-creation form on the (I think) latest version of phpmyadmin.

Code: Select all

Error

SQL-query :  

CREATE TABLE `site_items` (

`id` TINYINT( 2 ) NOT NULL AUTO_INCREMENT,
`bullet` TINYINT( 2 ) NOT NULL ,
`type` VARCHAR( 7 ) NOT NULL ,
`title` VARCHAR( 40 ) NOT NULL ,
`date` VARCHAR( 20 ) NOT NULL ,
`url` VARCHAR( 50 ) NOT NULL ,
`content` LONGTEXT( 500 ) NOT NULL ,
INDEX ( `id` ) 
) 

MySQL said: 


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 '(500) NOT NULL, INDEX (`id`))' at line 1
Back
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

CREATE TABLE `site_items` (
`id` TINYINT( 2 ) NOT NULL AUTO_INCREMENT,
`bullet` TINYINT( 2 ) NOT NULL ,
`type` VARCHAR( 7 ) NOT NULL ,
`title` VARCHAR( 40 ) NOT NULL ,
`date` VARCHAR( 20 ) NOT NULL ,
`url` VARCHAR( 50 ) NOT NULL ,
`content` LONGTEXT NOT NULL ,
INDEX ( `id` )
)
instead
User avatar
Sky
Forum Commoner
Posts: 71
Joined: Wed Oct 02, 2002 4:00 pm

Post by Sky »

I finally got it working... and that was the solution :) thanks much, again, volka... :D
Post Reply