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
https://forums.phpfreaks.com/topic/13662-cannot-create-tables/
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
https://forums.phpfreaks.com/topic/13662-cannot-create-tables/#findComment-52988
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
https://forums.phpfreaks.com/topic/13662-cannot-create-tables/#findComment-53011
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.