Adding up DATETIME field

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M. Bader

    #1

    Adding up DATETIME field

    Hi,

    i'm struggling with updating session expire times in my login table.

    Can you tell me, how to correctly add an amount of seconds (after that
    the session expires) to a datetime field?

    when i do the insert for a new login, or an update, the expire field
    will alway end up containing zeros

    below are my statements and structure, (MySQL version: 4.0.13)


    Thanks for any help

    Maik

    INSERT INTO `user_login` (
    `id_kontakt`,
    `id_user`,
    `session`,
    `expire`,
    `ip`,
    `browser`,
    `id_sprache`,
    `username`)
    VALUES (
    25,
    39,
    '10614612591424 93',
    (NOW()+SEC_TO_T IME(6000)),
    '192.168.0.3',
    'Opera/7.11 (Windows NT 5.0; U) [de]',
    1,
    'maik'
    );


    UPDATE `user_login` SET `expire` = (NOW()+SEC_TO_T IME(6000))
    WHERE `session` LIKE '10614612591424 93';


    CREATE TABLE `lok_user_login ` (
    `lfdnr` bigint(20) unsigned NOT NULL auto_increment,
    `id_kontakt` bigint(20) unsigned NOT NULL default '0',
    `id_user` bigint(20) unsigned NOT NULL default '0',
    `username` varchar(255) NOT NULL default '',
    `session` varchar(255) NOT NULL default '',
    `expire` datetime NOT NULL default '0000-00-00 00:00:00',
    `ip` varchar(15) NOT NULL default '',
    `browser` varchar(255) NOT NULL default '',
    `id_sprache` int(10) unsigned NOT NULL default '0',
    PRIMARY KEY (`lfdnr`),
    UNIQUE KEY `session` (`session`),
    FULLTEXT KEY `session2` (`session`)
    ) TYPE=MyISAM;






    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw

Working...