473,666 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1476

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1241
by: M. Bader | last post by:
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
6
1815
by: Carl | last post by:
Hi, to be use with SQL server database 1- From window form textbox object From this assignement, txtTOTAL.Text="0.00m"; How do you convert back to decimal type ? How do you assign a default datetime value to it ? How do you convert back the text enter by user into datetime ?
44
16954
by: Frank Rizzo | last post by:
Any ideas?
6
16251
by: FatboyCanteen | last post by:
When I using dataset to append a null value to the datetime field. It throw a error -> can not convert db.null to system.date Can there is any standard to pass a Null value to the DateTime Field! (It is successful to pass the Null Value to other type of Field)
1
1983
by: Thierry | last post by:
Hi, I've got the next problem: I have a datetime field in my database (sql-server) and I want the option in it that this field can be empty. But if I leave that datetime field empty I get the error: "The value you entered is not consistent with the data type or length of the column."
20
2131
by: Bryan | last post by:
hello all... im trying to add a record to an sql db on ms sql server 2000, using vb.net. seems to be working.. except for one thing, one of the columns in the database is a bit datatype, and though i get no syntax errors when compiling, i get an error indicated that the data would be truncated. the field is login_status. ive tried in quotes and not, giving it an integer variable with the number 1
5
2592
by: iulian.ilea | last post by:
Is correct to have a varchar field and insert dates of type dd/mm/yyyy into it? I choose this method because I have an application that runs on more than one server. So, if I used a datetime field (MSSQL Server) it worked on my test machine. If I run the same application on another machine with different regional settings is not working. I tried with date_default_timezone_set to change timezone but is not changing. After...
4
10692
by: Bill Gower | last post by:
Why won't this work? What do I need to do to make it work? DateTime? DateMember; if((DateTime.Parse(oldRow.ToString) == null)) DateMember = null; else DateMember = DateTime.Parse(oldRow.ToString()); The program is failing on the if saying that the null value in the field in
8
35972
by: David | last post by:
I'm trying to add a date and time to an html form, but I'm having a bit of trouble getting it working. Any suggestions? Thanks! ~ David (merlin001_at_gmail_dot_com)
0
8448
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.