Closed Thread Icon

Topic awaiting preservation: Quick MySQL question (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=24419" title="Pages that link to Topic awaiting preservation: Quick MySQL question (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Quick MySQL question <span class="small">(Page 1 of 1)</span>\

 
Jimmy
Nervous Wreck (II) Inmate

From: Alderaan
Insane since: Sep 2004

posted posted 12-16-2004 16:48

Sorry to hijack the main forum for this. I just had a quick question and time might be an issue.

I'm trying to create a guestbook using PHP/MySQL for a class project. It doesn't have to be anything fancy or overly advanced. I just need to be able to create entries and then display them. The overall PHP should be simple but I'm having some problems creating my mySQL table using phpmyadmin. I'm trying the following:

code:
CREATE TABLE `guestbook` (
`id` INT( 255 ) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 255 ) NOT NULL ,
`date` VARCHAR( 255 ) NOT NULL ,
`time` VARCHAR( 255 ) NOT NULL ,
`entry` LONGTEXT( 10000 ) NOT NULL ,
`f_color` VARCHAR( 255 ) NOT NULL ,
`b_color` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `id` )
)



The error I get is (cut & pasted EXACTLY):

MySQL said:


MySQL said:

quote:
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, `f_color` VARCHAR(255) NOT NULL, `b_color` VA



I don't have a clue what that error means but I'm pretty sure it has to do with the field 'entry'. I wanted to use longtext but I don't know how big that is. Does anyone know what's wrong with this? I'd very much appreciate an answer.

Thanks so much for everyones help!

Jim

kuckus
Paranoid (IV) Mad Librarian

From: Glienicke
Insane since: Dec 2001

posted posted 12-16-2004 16:57

Hey Jim

Longtext should work fine if you don't specify a maximum length inside the brackets, so the first thing I'd try is

code:
CREATE TABLE `guestbook` (
`id` INT( 255 ) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 255 ) NOT NULL ,
`date` VARCHAR( 255 ) NOT NULL ,
`time` VARCHAR( 255 ) NOT NULL ,
`entry` LONGTEXT NOT NULL ,
`f_color` VARCHAR( 255 ) NOT NULL ,
`b_color` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `id` )
)



kuckus

Jimmy
Nervous Wreck (II) Inmate

From: Alderaan
Insane since: Sep 2004

posted posted 12-16-2004 18:01

Thank you so much Kuckus!
<--- happy

Jim

Jim

« BackwardsOnwards »

Show Forum Drop Down Menu