Error database - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error database (
/showthread.php?tid=664447)
Error database -
NikodemPolak - 01.03.2019
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
Re: Error database -
NikodemPolak - 01.03.2019
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`
Re: Error database -
JasonRiggs - 01.03.2019
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.