Jump to content
  • 0
Version

gettime or gettimestr

Question

4 answers to this question

Recommended Posts

  • 1
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 ('"[email protected]_code$+"', '"[email protected]+"', '"+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$)+"', '"[email protected]+"', '"+strcharinfo(0)+"', NOW())");

Store your data like above.

Then whenever you pull the data, format them first before showing to the npc.

Edited by Patskie
  • Upvote 1
Link to comment
Share on other sites

  • 0
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 ('"[email protected]_code$+"', '"[email protected]+"', '"+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 ('"[email protected]_code$+"', '"[email protected]+"', '"+strcharinfo(0)+"',  '"+gettimestr("%Y-%m/%d %H:%M:%S",21);+"')";

 

thank you Patskie,Emistry, and Start_

solved.. that escape_sql and now() works..

 

Link to comment
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.   Paste as plain text instead

  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

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