Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9266471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:19:36+00:00 2026-06-18T14:19:36+00:00

I am trying to update a DATETIME field in a table. What I want

  • 0

I am trying to update a DATETIME field in a table. What I want for it is to always have three hours before it expires.

My current code is:

UPDATE mindcore_sessions
  SET session_time = DATE_ADD(session_time, INTERVAL 3 HOUR)
  WHERE session_id = '$sessionId';

An example value would be: 2013-02-11 00:00:00. If I run this query, it will change to: 2013-02-11 03:00:00. Which is correct. But, if it is run again, it changes to 2013-02-11 06:00:00 and so on.

What I want for it is to always be only three hours ahead. This is hard to explain, but I just want it to stay the same if it is run again. And if it is run again 1 minute later, I want it to increment by just one minute.

Sorry if the question is verbose, but I am utterly confused (and it is late!).

Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:19:37+00:00Added an answer on June 18, 2026 at 2:19 pm

    Instead of adding three(3) hours to the last session_time, add three(3) hours to NOW():

    update mindcore_sessions
    set session_time = DATE_ADD(NOW(), INTERVAL 3 HOUR)
    where session_id = '$sessionId';`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to update my datetime field in a table with the following PHP
I'm trying to update a DATETIME field in one table based on the latest
I`m trying to update time in datetime field as UPDATE table_name SET col_name=to_DATE('04/02/2012 00:12:00','MM/DD/YYYY
Im trying to update a table with the following code. If I change WHERE
I am trying to update just the day component on a datetime field on
I am trying to write the current date into a database table. I have
Im trying to update the contents of an element after running some php code.
I'm trying to update my code to use cv2.SURF() as opposed to cv2.FeatureDetector_create(SURF) and
I have a field that creates a comment (named pcomment). I am trying to
I have a user_profile_view table: The definition is as follows: +------------+------------+------+-----+---------+----------------+ | Field |

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.