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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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