Jump to content
  • 0

SQL Insert Problem


Sere

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   2
  • Joined:  02/11/12
  • Last Seen:  

Hello everybody.

 

I wanted to script a way to get the credits of the donation shop with some ingame items. The NPC I made has his own sql table but my problem is, if I try to insert the accountid of the user he don't add it.

 

Here is the script :

mes "[Coin Manager]";
    mes "========= Credits Info ===========";
    query_sql ("select account_id,balance from `cp_credits`", .@acid,.@bala);
    mes "Account: ^FF0000"+.@acid+"^000000";
    mes "Credits: ^00FF00"+.@bala+"^000000";
    mes "==============================";
    next;
    mes "[Coin Manager]";
    mes "Okay.";
    mes "For every ^00FF00Mithril Coin^000000 you will become ^FF00005x Cash Points^000000!";
    mes "How many ^00FF00Mithril Coins^000000 you want to exchange?";
    if (countitem(674) >= 1){
    next;
    input .@nummer;
    if (countitem(674) >= .@nummer) {
    set .@bala,.@bala+.@nummer*5;
    query_sql "UPDATE `cp_credits` SET `balance` = '"+.@bala+"' WHERE account_id = '"+getcharid(3)+"'";
    delitem 674,.@nummer;
    dispbottom "The exchange was succesfull. You gained ["+.@nummer*5+" Cash Punkte] and you have now ["+.@bala+"].";
    close;

 

 

 

 

I tried many other ways to add the accountid. With insert he became an error or don't made anything.

I don't know how to fix it. All ways I find on google don't solved the problem. Hopefully someone of you can help me.

 

And sry for my bad english.

 

Greetings Sere



can't anyone help? T_T

Edited by Emistry
use [code] tag for script contents.
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

I don't see the part with your insert query

query_sql "INSERT INTO `cp_credits`  ...  ";
 

Can you paste that part of the script?

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...