Error database
#1

Hello everyone, I need help!


By adding this table to the database [/B]

CREATE TABLE `suspended` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`suspendedby` int(11) NOT NULL,
`stime` varchar(34) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`reason` varchar(34) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `suspended`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
ALTER TABLE `suspended`
ADD PRIMARY KEY (`id`);


The Data Base returns this error to me

1075 - There can only be one auto field in the table and it must be defined as a key
Reply
#2

I gave yes, now a different mistake


CREATE TABLE `suspended` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`suspendedby` int(11) NOT NULL,
`stime` varchar(34) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`reason` varchar(34) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `suspended`
MODIFY `id` int(11) NOT NULL, AUTO_INCREMENT=2;
ALTER TABLE `suspended`
ADD PRIMARY KEY (`id`);


1067 - Invalid default value for `date`
Reply
#3

I saw this problem before, I believe that you don't need to put "DEFAULT" for the timestamp type column because it's already its default to check the current timestamp.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)