Jump to content

How would I get the expire colum from my database and take it away from the time now to display how long they have left ?


Recommended Posts

I have a online database with a column called consoles.

 

Inside that, I have 2 rows called time and expire, I want to take the expire colum and minus it from the time now to tell them how long they have left online.

 

I also have another column called cpukey, this is for when they type in something, it checks the cpukey column and does their information.

 

I have something like this so far : http://gyazo.com/40feb904fc933a4d6b8392e99392c4bb , but it just displays the key again, I need it to take away the expire column by the time now. 

 

Anyone help me I would be really thankfull.

Use TIMEDIFF() function

 

EG

mysql> SELECT TIMEDIFF('2015-02-07 18:00:00', NOW()) as time_remain;
+-------------+
| time_remain |
+-------------+
| 02:53:29    |
+-------------+

 

Use TIMEDIFF() function

 

EG

mysql> SELECT TIMEDIFF('2015-02-07 18:00:00', NOW()) as time_remain;
+-------------+
| time_remain |
+-------------+
| 02:53:29    |
+-------------+

so how would I set it out ? mysql> SELECT TIMEDIFF('2015-02-07 18:00:00', NOW()) as time_remain; what is this table called or do I need to create a new table ?

I don't know what the table is called. It's your table. I am just showing how to subtract the current time from another and get the result

SELECT TIMEDIFF(expire, NOW()) as time_remain  FROM whateveryourtableiscalled
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.