Jump to content

Subtract from timestamp


cdoyle

Recommended Posts

Hi,

 

I have a field in my table that has a Timestamp.

It's basically used for when a player is no longer dead in the game.

 

The player is considered dead until current time is great then the timestamp.

I was able to get this working and seems to work great.

 

So now to the next part..

I want to give users a way to buy there way out of the hospital.

so I'm trying to create an update query to subtract from that timestamp, but I can't seem to get it to work.

 

for a test I'm trying to subtract a set amount.

$query = $db->execute("update `players` set `dead_time_remaining`=`dead_time_remaining`-?, where `id`=?", array(120, $player->id));

 

A timestamp is seconds right?  So the 120 would be 120 seconds right?

Right now, it's not subtracting anything when I run the query.

 

Link to comment
Share on other sites

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.