Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old June 30th, 2003, 08:26 AM
geeltje geeltje is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 10 geeltje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 2 sec
Reputation Power: 0
error in sql syntax

When i try to run this:

SQL-query :

CREATE TABLE algem(

INDEX int( 11 ) NOT NULL default '0',
titel text NOT NULL ,
alg text NOT NULL ,
PRIMARY KEY ( INDEX )
) TYPE = MYISAM


i get an error as result:

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 'int( 11 ) NOT NULL default '0', titel text NOT NULL , alg

what i want is to create a table called "algem"
with 3 fields
1: "index" needs to be the primary key
2: "titel" only 1 line of text
3: "alg" will contain articles

i used phpmyadmin

thanks

Reply With Quote
  #2  
Old June 30th, 2003, 08:47 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,295 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 1 h 36 m 24 sec
Reputation Power: 760
INDEX is a reserved word and you probably shouldn't use it for a column name. The norm would be to use "id". You can tell you've used a keyword in phpMyAdmin when it automatically capatalizes it; I believe it's another color too. Title shouldn't be a TEXT field b/c a text field's max lenght is 65565 (around there) and that's too big for a title. Use VARCHAR or TINYTEXT.
Code:
CREATE TABLE `algem` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`title` VARCHAR( 100 ) NOT NULL ,
`alg` TEXT NOT NULL ,
PRIMARY KEY ( `id` )
);

Reply With Quote
  #3  
Old June 30th, 2003, 08:51 AM
geeltje geeltje is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 10 geeltje User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 2 sec
Reputation Power: 0
thanks hun

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > error in sql syntax


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway