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 ?


chowderrunnah

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.