Gentoo Archives: gentoo-user

From: Joseph <syscon780@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW()
Date: Fri, 28 Dec 2012 15:57:11
Message-Id: 20121228155630.GB25197@syscon7.inet
In Reply to: Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW() by Michael Orlitzky
1 On 12/28/12 02:00, Michael Orlitzky wrote:
2 >On 12/28/2012 01:44 AM, Joseph wrote:
3 >> I'm not a PHP programmer but I'll try to explain my problem.
4 >> I've create table in my php database:
5 >>
6 >> DROP TABLE IF EXISTS visual_verify_code;
7 >> CREATE TABLE visual_verify_code (
8 >> oscsid varchar(32) NOT NULL,
9 >> code varchar(6) NOT NULL,
10 >> dt TIMESTAMP(12) NOT NULL DEFAULT NOW(),
11 >> PRIMARY KEY (oscsid)
12 >> );
13 >>
14 >
15 >Looks fine.
16 >
17 >
18 >> It worked OK, after few days I backup my database and try to restore it, but it keeps complaining on the "dt":
19 >> ERROR 1067 (42000) at line 38009: Invalid default value for 'dt'
20 >>
21 >> so the database is dropped but never restored. The backup data base contain:
22 >>
23 >> create table visual_verify_code (
24 >> oscsid varchar(32) not null ,
25 >> code varchar(6) not null ,
26 >> dt timestamp default 'CURRENT_TIMESTAMP' not null ,
27 >> PRIMARY KEY (oscsid)
28 >> );
29 >
30 >
31 >CURRENT_TIMESTAMP shouldn't be quoted. How are you backing up the database?
32
33 Your are correct, when I removed the quotes it worked.
34
35 I'm backing it up through the backup.php sript that came with osCommerce, I can post it but it is a long one.
36
37 --
38 Joseph

Replies

Subject Author
Re: [gentoo-user] php CURRENT_TIMESTAMP vs NOW() Michael Orlitzky <michael@××××××××.com>