How to update sql with date?

nasagnilac

New member
Messages
121
Points
0
Github
gmblank
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)+"'";



Code:
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?

 
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

 
Last edited by a moderator:
Back
Top