massive mysql table? 10000 characters

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
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

massive mysql table? 10000 characters

Post by .Stealth »

hi, what sort of field will i use for something of this size (10000 characters)

i want it for a tutorial thingy im designing.
on my site i will have a form to add tutorials using mysql.

there will be 3 fields:
id (auto increment)
title (its title)
content (the text)

the content needs to be real big to hold all of the text that the tutorial will have in it, i was thinking around 10000 characters or maybe more.

i tried to use the BLOB but it didnt work, said i had errors in my syntax.

what sort of field can i use for this?

thanks.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: massive mysql table? 10000 characters

Post by volka »

.Stealth wrote:i tried to use the BLOB but it didnt work, said i had errors in my syntax.
What errror exactly and what query did you execute when getting this error?
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

Post by .Stealth »

hi, i used this:

Error

SQL-query :

CREATE TABLE `tutorials` (
`id` INT( 3 ) NOT NULL AUTO_INCREMENT ,
`title` VARCHAR( 35 ) NOT NULL ,
`content` TEXT( 10000 ) NOT NULL
)

MySQL said:
#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 '(10000) NOT NULL)' at line 1


thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

At least there's a KEY statement missing. Did you actually copy and paste this query?
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

Post by .Stealth »

i did it with php myadmin, i just used the form.

this one:

http://www.sketchfx.co.uk/imghost/uploa ... 5d0aab.jpg
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

Try out the TEXT field.
I don't think the length should be a problem:
  • TEXT: 2^16 or 65536 bytes
  • MEDIUMTEXT: 2^24 or 16777216 bytes
  • LONGTEXT: 2^32 or 4294967296 bytes
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

.Stealth wrote:i did it with php myadmin, i just used the form.

this one:

http://www.sketchfx.co.uk/imghost/uploa ... 5d0aab.jpg
I was to late with the previous post :wink:
Mabe try out text without a number.
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

Post by .Stealth »

oh ok thanks, seemed to solve that bit but i tried longtext and text without values and ive got this now lol:

MySQL said:
#1075 - Incorrect table definition; There can only be one auto column and it must be defined as a key
User avatar
WaldoMonster
Forum Contributor
Posts: 225
Joined: Mon Apr 19, 2004 6:19 pm
Contact:

Post by WaldoMonster »

.Stealth wrote:oh ok thanks, seemed to solve that bit but i tried longtext and text without values and ive got this now lol:

MySQL said:
#1075 - Incorrect table definition; There can only be one auto column and it must be defined as a key
There can only be one field with auto_increment in a table.
Or is it something else?
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

Post by .Stealth »

hmm yeah thats what i dont get, only the id field has auto increment 8O
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

The error says there can only be 1 auto column (check) and it must be defined as key (not check)
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

Post by .Stealth »

ooo that worked, i set it as primary, and in access primary is primary key.

thanks for your help people, i can now begin on my big task which is most likley going to fill this place up with help topics lol.

thanks alot :D
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Moved to Databases, as this had absolutely nothing to do with PHP.
Post Reply