Ninja Posted August 20, 2012 Group: Members Topic Count: 54 Topics Per Day: 0.01 Content Count: 513 Reputation: 84 Joined: 08/11/12 Last Seen: July 4, 2024 Share Posted August 20, 2012 Just wanna ask how to do SQL Querying. to be specific How to make an SQL Query to get a character's CharID from SQLdb? help will be very much appreciated. Quote Link to comment Share on other sites More sharing options...
Emistry Posted August 20, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2371 Joined: 10/28/11 Last Seen: Yesterday at 02:49 PM Share Posted August 20, 2012 well you can refer to this http://dev.mysql.com/doc/refman/5.0/en/select.html Example: set @nb, query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", @name$, @fame); mes "Hall Of Fame: TOP5"; mes "1."+@name$[0]+"("+@fame[0]+")"; // Will return a person with the biggest fame value. mes "2."+@name$[1]+"("+@fame[1]+")"; mes "3."+@name$[2]+"("+@fame[2]+")"; mes "4."+@name$[3]+"("+@fame[3]+")"; mes "5."+@name$[4]+"("+@fame[4]+")"; 1 Quote Link to comment Share on other sites More sharing options...
Ninja Posted August 20, 2012 Group: Members Topic Count: 54 Topics Per Day: 0.01 Content Count: 513 Reputation: 84 Joined: 08/11/12 Last Seen: July 4, 2024 Author Share Posted August 20, 2012 I see. looking at script.c for query_sql, does it also allow you to write data into it? like UPDATE `ragnarok`.`char` SET `name`='Jezznar' WHERE `char_id`='150002'; will this be possible? Quote Link to comment Share on other sites More sharing options...
Emistry Posted August 20, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2371 Joined: 10/28/11 Last Seen: Yesterday at 02:49 PM Share Posted August 20, 2012 all SQL related stuff is working.... so far i didnt see any of it didnt work.... Quote Link to comment Share on other sites More sharing options...
Ninja Posted August 20, 2012 Group: Members Topic Count: 54 Topics Per Day: 0.01 Content Count: 513 Reputation: 84 Joined: 08/11/12 Last Seen: July 4, 2024 Author Share Posted August 20, 2012 alright. and by the way, I was wondering why this was moved in the scripting section? @_@ well, thanks anyway I was supposed to write a separate one for scripting since I also need to know how to do it in the source side. and thanks for the answers Quote Link to comment Share on other sites More sharing options...
Emistry Posted August 20, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2371 Joined: 10/28/11 Last Seen: Yesterday at 02:49 PM Share Posted August 20, 2012 i though you are just requesting this to work in a NPC/Script so i move this to script support.. if you want to do it in source part.. you can refer to some example , ( picked randomly inside the src files ) //Update DB if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `online`='1' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) ) Sql_ShowDebug(sql_handle); 1 Quote Link to comment Share on other sites More sharing options...
Ninja Posted August 20, 2012 Group: Members Topic Count: 54 Topics Per Day: 0.01 Content Count: 513 Reputation: 84 Joined: 08/11/12 Last Seen: July 4, 2024 Author Share Posted August 20, 2012 this really helps. my freakin' VS2010 kinda crashes 9/10 of the time so I had to do the last resort~ and that's ask in the support section. anyway big thanks! Quote Link to comment Share on other sites More sharing options...
Question
Ninja
Just wanna ask how to do SQL Querying. to be specific How to make an SQL Query to get a character's CharID from SQLdb?
help will be very much appreciated.
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.