List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 26 2002 2:31am
Subject:Re: TIMESTAMP null value help
View as plain text  
At 19:32 -0600 11/25/02, Ronald Petty wrote:
>I am trying to get my TIMESTAMPE field to auto update (use the current time
>for inserts).  However it keeps going to all 0000000000, I read the
>documentation and it says that is because it is getting an invalid input.
>However it also states if you put null in it will work, it does on the
>server, but when I use perl/dbi it goes to 000000

That's because to specify NULL in DBI, you should use undef.

>
>Here is the code
>my $sth1 = $dbh->prepare("insert into CONTACT values (?,?,?,?,?,?,?,?)");
>
>$sth1->execute($query->param("NAME"), $query->param("COMPANY"),
>$query->param("EMAIL"), $query->param("PHONE"), $quer
>y->param("ADDRESS"), $query->param("SUBJECT"), $query->param("MESSAGE"),
>null) or die "Can't execute SQL statement: $
>DBI::errstr\n";
>
>and the results for the ones using the form about have all zeros, if I do
>
>insert into CONTACT (NAME,COMPANY,EMAIL,PHONE,ADDRESS,SUBJECT,MESSAGE,DATE)
>values ("Ron Petty", "asdfasdf", "asdf@stripped", "asdfddd",
>"sdfsadfasdfsad", "Testing contact", "Hey did
>this thing work?", null);
>
>It works, any ideas?
>Thanks
>Ron

Thread
TIMESTAMP null value helpRonald Petty26 Nov
  • Re: TIMESTAMP null value helpPaul DuBois26 Nov