Computing.Net > Forums > Web Development > sql error

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

sql error

Reply to Message Icon

Name: tyros
Date: November 29, 2004 at 08:41:53 Pacific
OS: xp
CPU/Ram: 2.5ghz,256mb
Comment:

someone can tell me what my error on this?

CREATE TABLE `submit` (

`id` INT( 6 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
`name` CHAR( 75 ) NOT NULL ,
`url` CHAR( 75 ) NOT NULL ,
`description` TEXT( 150 ) NOT NULL ,
`vote` INT( 6 ) DEFAULT '0' NOT NULL ,
PRIMARY KEY ( `id` ) ,
UNIQUE (
`name` ,
`url`
)
)

cause i got this error :

#1064 - 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 '(150) NOT NULL, `vote` INT(6) DEFAULT '0' NOT NULL, PRIMARY KEY

thanks for help




Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: November 29, 2004 at 11:31:37 Pacific
Reply:

Most of the single quotes that you have are illegal. You can't have quotes around 'submit' nor any of the field names (id, name, url, etc).

Actually, I'd guess that none of them are necessary.

You can download MySQL documentation at dev.mysql.com/doc. I keep a link to this documentation on my desktop so that I can get to it easily.

Be sure to come back and let us know if our suggestions helped!


0

Response Number 2
Name: tyros
Date: November 29, 2004 at 11:51:27 Pacific
Reply:

yeah but im using phpmyadin so i dont have to write the code.

sorry i have not mention that on my first post


0

Response Number 3
Name: Don Arnett
Date: November 29, 2004 at 14:22:48 Pacific
Reply:

According to the MySQL docs (this page), the TEXT field is not allowed to have a length attribute (the 150 in parens).

Note that for int, the definition includes:

INT[(length)]

indicating that after INT you can include parens with a length integer.

But the TEXT field does not include this option.


Why phpmysqladmin would allow you to do this if it's illegal, I can't say. Maybe it's legal in some versions and not others.

Be sure to come back and let us know if our suggestions helped!


0

Response Number 4
Name: tyros
Date: November 29, 2004 at 15:59:17 Pacific
Reply:

thanks for your help.

you right i cant type a value for Text.

thanks again


0

Response Number 5
Name: FBI Agent
Date: November 30, 2004 at 08:04:55 Pacific
Reply:

those arent single quotes, those are the shift tilde thingy's which i dont remember the name of.

FBI Agent

AIM: EliteAssassin187


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Calling java script funct... Need help for Upload Pic ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: sql error

Accessing data from a db w/ php www.computing.net/answers/webdevel/accessing-data-from-a-db-w-php/128.html

Sorting Numbers with VB.NET www.computing.net/answers/webdevel/sorting-numbers-with-vbnet/3191.html

error #1251 www.computing.net/answers/webdevel/error-1251/1230.html