Page 1 of 1

massive mysql table? 10000 characters

Posted: Mon Jan 29, 2007 11:41 am
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.

Re: massive mysql table? 10000 characters

Posted: Mon Jan 29, 2007 11:49 am
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?

Posted: Mon Jan 29, 2007 11:50 am
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

Posted: Mon Jan 29, 2007 11:53 am
by volka
At least there's a KEY statement missing. Did you actually copy and paste this query?

Posted: Mon Jan 29, 2007 11:57 am
by .Stealth
i did it with php myadmin, i just used the form.

this one:

http://www.sketchfx.co.uk/imghost/uploa ... 5d0aab.jpg

Posted: Mon Jan 29, 2007 12:02 pm
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

Posted: Mon Jan 29, 2007 12:04 pm
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.

Posted: Mon Jan 29, 2007 12:06 pm
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

Posted: Mon Jan 29, 2007 12:14 pm
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?

Posted: Mon Jan 29, 2007 12:18 pm
by .Stealth
hmm yeah thats what i dont get, only the id field has auto increment 8O

Posted: Mon Jan 29, 2007 12:20 pm
by pickle
The error says there can only be 1 auto column (check) and it must be defined as key (not check)

Posted: Mon Jan 29, 2007 12:24 pm
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

Posted: Mon Jan 29, 2007 1:03 pm
by RobertGonzalez
Moved to Databases, as this had absolutely nothing to do with PHP.