Jump to content
  • 0

Sql problem


WordsUp

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

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;
}

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

ahh okay thanks i will try that

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