Jump to content
  • 0
Sign in to follow this  
nasagnilac

How to update sql with date?

Question

I want to add a log in my db with timestamp but the time is still null.

query_sql "UPDATE `ea_purchase` SET `status` = '0' AND `redeem_date` = '"+TIMESTAMP+"' WHERE `purchase_id` = '"+.@shop_id+"' AND `status` = '1' AND `account_id` = '"+getcharid(3)+"'";

 

CREATE TABLE IF NOT EXISTS `ea_purchase` (
  `purchase_id` int(11) NOT NULL,
  `account_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL DEFAULT '0',
  `quantity` int(4) NOT NULL DEFAULT '0',
  `item_name` varchar(255) NOT NULL DEFAULT '',
  `currency` varchar(100) NOT NULL DEFAULT '',
  `refine` int(2) NOT NULL DEFAULT '0',
  `slot` int(2) NOT NULL DEFAULT '0',
  `bounded` int(1) NOT NULL DEFAULT '0',
  `amount` int(4) NOT NULL DEFAULT '0',
  `price` int(11) DEFAULT '0',
  `subtotal` int(11) NOT NULL DEFAULT '0',
  `status` int(2) DEFAULT '1',
  `purchased_on` datetime DEFAULT '1000-01-01 00:00:00',
  `redeem_date` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

 

What the things I need to fix?

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

You can add NOW() in the sql syntax and will put a datetime with the current server time... As far I know, timestamp is for linux epoch time purpouses, but you can use a datetime and use NOW() when update or insert

Edited by rokimoki

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Answer this question...

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

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.