Jump to content
  • 0

Sql problem


Question

Posted

I have created this code for my server and inserted it on my agit_template.txt file but the problem is everytime the emp is broken it didn't return

query_sql "SELECT `char_id` FROM `char` WHERE `char_id` = '"+getcharid(0)+"'",@exist$;
if (getarraysize(@exist$) != 0){
query_sql "UPDATE `char` SET `empbreak` = `empbreak` + '1' WHERE `char_id` = '"+getcharid(0)+"'";
end;
} 


query_sql "SELECT `guild_id` FROM `woe_guild_breaks` WHERE `guild_id` = '"+getcharid(2)+"'",@GDExist$;
if (getarraysize(@GDExist$) != 0){
query_sql "UPDATE `woe_guild_breaks` SET `id` = `id` + '1' WHERE `guild_id` = '"+getcharid(2)+"'";
} else {
query_sql "INSERT INTO `woe_guild_breaks` (`castle_id`, `guild_id`, `id`) VALUES ('15','"+getcharid(2)+"','1')";
end;
}

4 answers to this question

Recommended Posts

Posted (edited)

char_id is a integer i guess it should be @exist

guild_id is a integer i guess it should be @GDExist

I guess your insert command must be like this

query_sql "INSERT INTO `woe_guild_breaks` (`castle_id`, `guild_id`, `id`) VALUES ('15',"+getcharid(2)+",1)";

[/code]

Edited by JayPeeMateo
Posted

char_id is a integer i guess it should be @exist

guild_id is a integer i guess it should be @GDExist

I guess your insert command must be like this

query_sql "INSERT INTO `woe_guild_breaks` (`castle_id`, `guild_id`, `id`) VALUES ('15',"+getcharid(2)+",1)";

[/code]

the query_sql works fine it saves into my sql correctly.

the char_id and guild_id i didn't understand sorry.

Posted

char_id and guild_id both returns an integer or numerical value. a variable that ends with a $ means it is a string variable but a variable do not end with a $ it is considered as integer or numerical variable

.myvar$ - this is string variable.

.myvar - this is integer or numerical variable.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...