Jump to content

Cannot create tables


philgh

Recommended Posts

Help!
I get errors when i run this to try creating a table.
Please anyone help me correct if there is an error

CREATE TABLE `comments_visitors` (
`id_comm` int(11) NOT NULL auto_increment,
`idart_comm` int(11),
`text_comm` varchar NOT NULL default '',
'idusr_comm' int(11) NOT NULL DEFAULT '',
`date_comm` date NOT NULL default '0000-00-00',
`valid_comm` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_comm`)
);


Please help
Link to comment
Share on other sites

A number of problems:

- you're using string literals instead of backticks for the "idusr_comm" column (not that backticks are necessary at all)
- you need to specify a length for the varchar column type for the "text_comm" column
- your default for INT should really be 0, not '', for "idusr_comm"

Hope that helps.
Link to comment
Share on other sites

Hi here is the code that will create the table for you:

[code]
CREATE TABLE `comments_visitors` (
  `id_comm` int(11) unsigned NOT NULL auto_increment,
  `idart_comm` int(11) unsigned NOT NULL default '0',
  `text_comm` varchar(255) NOT NULL default '',
  `idusr_comm` int(11) unsigned NOT NULL default '0',
  `date_comm` date NOT NULL default '0000-00-00',
  `valid_comm` tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id_comm`)
)[/code]

hope that helps as well
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.