Version Posted August 29, 2020 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 06/08/20 Last Seen: October 30, 2021 Share Posted August 29, 2020 how to get current time of redeem item from npc to sql logs? this kind of format ? 2020-07-27 13:49:41 Quote Link to comment Share on other sites More sharing options...
1 Patskie Posted August 30, 2020 Group: Members Topic Count: 50 Topics Per Day: 0.01 Content Count: 1702 Reputation: 241 Joined: 09/05/12 Last Seen: 49 minutes ago Share Posted August 30, 2020 (edited) 31 minutes ago, Version said: still error script:add_word: invalid word. A word consists of undercores and/or alphanumeric characters, and valid variable prefixes/postfixes. query_sql "INSERT INTO `redeembetalog` (`code`, `item_amount`,`name`, `time`) VALUES ('"+@voucher_code$+"', '"+@amt+"', '"+strcharinfo(0)+"', '"+gettimestr("%Y-%m/%d %H:%M:%S",21);+"')"; query_sql ("INSERT INTO `redeembetalog` (`code`, `item_amount`,`name`, `time`) VALUES ('"+escape_sql(@voucher_code$)+"', '"+@amt+"', '"+strcharinfo(0)+"', NOW())"); Store your data like above. Then whenever you pull the data, format them first before showing to the npc. Edited August 30, 2020 by Patskie 1 Quote Link to comment Share on other sites More sharing options...
1 Emistry Posted August 30, 2020 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 14 hours ago Share Posted August 30, 2020 create a datetime column in your sql table, and store the value using this https://www.w3schools.com/sql/func_mysql_now.asp Quote Link to comment Share on other sites More sharing options...
0 Start_ Posted August 30, 2020 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 950 Reputation: 180 Joined: 04/05/13 Last Seen: 6 hours ago Share Posted August 30, 2020 gettimestr refer: \doc\script_commands.txt lines 3167 Quote Link to comment Share on other sites More sharing options...
0 Version Posted August 30, 2020 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 06/08/20 Last Seen: October 30, 2021 Author Share Posted August 30, 2020 7 hours ago, Emistry said: create a datetime column in your sql table, and store the value using this https://www.w3schools.com/sql/func_mysql_now.asp still dont get it.. error need '(' query_sql "INSERT INTO `redeembetalog` (`code`, `item_amount`,`name`, `time`) VALUES ('"+@voucher_code$+"', '"+@amt+"', '"+strcharinfo(0)+"', '"+SELECT NOW() + 1;+"')"; 10 hours ago, Start_ said: gettimestr refer: \doc\script_commands.txt lines 3167 still error script:add_word: invalid word. A word consists of undercores and/or alphanumeric characters, and valid variable prefixes/postfixes. query_sql "INSERT INTO `redeembetalog` (`code`, `item_amount`,`name`, `time`) VALUES ('"+@voucher_code$+"', '"+@amt+"', '"+strcharinfo(0)+"', '"+gettimestr("%Y-%m/%d %H:%M:%S",21);+"')"; thank you Patskie,Emistry, and Start_ solved.. that escape_sql and now() works.. Quote Link to comment Share on other sites More sharing options...
Question
Version
how to get current time of redeem item from npc to sql logs?
this kind of format ?
2020-07-27 13:49:41
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.