Jedzkie 58 Posted September 2, 2015 hi how can I randomly set cash point to my account using query_sql? example: query_sql ("UPDATE `cash` SET `cash_point` = cash_point + rand(100,1000) WHERE `account_id` = '"+getcharid(3)+"'"); if i use the item, this is the error. DB error - Operand should contain 1 column(s) Thanks! Quote Share this post Link to post Share on other sites
0 KirieZ 88 Posted September 3, 2015 @@Frost When you run a SELECT query, you must pass variables to store the returned data. query_sql("SELECT `cash_point` FROM `cash` WHERE `account_id` = "+getcharid(3), .@newCash);dispbottom "Now you have " + .@newCash; Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 2, 2015 query_sql ("UPDATE `cash` SET `cash_point` = " + rand(100,1000) + " WHERE `account_id` = " + getcharid(3)); 1 Jedzkie reacted to this Quote Share this post Link to post Share on other sites
0 evilpuncker 503 Posted September 2, 2015 query_sql ("UPDATE `cash` SET `cash_point` = " + rand(100,1000) + " WHERE `account_id` = " + getcharid(3)); please note that it will just change the current (entire) value to a random amount, instead of increasing it Quote Share this post Link to post Share on other sites
0 Garr 117 Posted September 2, 2015 Well, he did say "randomly set", not "randomly increase", thus I changed it accordingly Quote Share this post Link to post Share on other sites
0 Jedzkie 58 Posted September 2, 2015 (edited) query_sql ("UPDATE `cash` SET `cash_point` = " + rand(100,1000) + " WHERE `account_id` = " + getcharid(3)); please note that it will just change the current (entire) value to a random amount, instead of increasing it actually you're right, i forgot to say that randomly increase, but i already fixed it. Thanks BTW Well, he did say "randomly set", not "randomly increase", thus I changed it accordingly Hi Garr! thanks for the quick response, how about a message to tell how much Points you get? Edit: NvM I figured it out the message of how many points you get, but I want to add another message that tells what is the total points in your account. example: query_sql("SELECT `cash_point` FROM `cash` WHERE `account_id` = "+getcharid(3)); is this right? i have a error message after executing this script. 'script:query_sql: Too many columns. discarding last 1 columns.' Edited September 2, 2015 by Frost Quote Share this post Link to post Share on other sites
0 Jedzkie 58 Posted September 3, 2015 @@Frost When you run a SELECT query, you must pass variables to store the returned data. query_sql("SELECT `cash_point` FROM `cash` WHERE `account_id` = "+getcharid(3), .@newCash);dispbottom "Now you have " + .@newCash; Thanks! Quote Share this post Link to post Share on other sites
hi how can I randomly set cash point to my account using query_sql?
example:
query_sql ("UPDATE `cash` SET `cash_point` = cash_point + rand(100,1000) WHERE `account_id` = '"+getcharid(3)+"'");
if i use the item, this is the error. DB error - Operand should contain 1 column(s)
Thanks!
Share this post
Link to post
Share on other sites