Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Timestamp problem

by Tomte (Priest)
on May 16, 2007 at 08:07 UTC ( #615709=note: print w/replies, xml ) Need Help??


in reply to Timestamp problem

First things first:
Please ask your questions in english...this forum is an international effort, writing correct english as best as you can is not only polite but increases the chance of a helpful answer significantly - errors are normal and anticipated, but constructs as "CAn u plz" are frowned upon.

On to your problem:

  • Use placeholders, don't concatenate SQL statements and values
  • Use mysql onboard functions everywhere you can, there is an inverse function to the "unix_timestamp()" you are using, and thats "from_unixtime()"
Untested example to get you started:
[...] my $stmt = $dbh->prepare("insert into test1 values(FROM_UNIXTIME(?))") + or die("couldn't prepare insert: " . $@); $stmt->execute(time()-$old_time) or die ("couldn't perform insert: " . + $@); [...]
Consult The documentation available to repair my errors...

regards,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://615709]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2021-10-26 19:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (90 votes). Check out past polls.

    Notices?