Jump to content


Cannot create tables

  • Please log in to reply
2 replies to this topic

#1 philgh

  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 04 July 2006 - 06:05 PM

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

#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 04 July 2006 - 06:40 PM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 paul2463

  • Members
  • PipPipPip
  • Advanced Member
  • 955 posts
  • LocationUK

Posted 04 July 2006 - 07:41 PM

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

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`)

hope that helps as well
you cannot affect the past but you can ruin a perfectly good present by worrying about the future

The <A HREF="http://www.php.net/d...php">MANUAL</A> is actually a useful resource

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users