query_sql - Jeybla/rathena GitHub Wiki
- query_sql("your MySQL query"{, {, {, ...}}});
- query_logsql("your MySQL query"{, {, {, ...}}});
Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values, and will return the number of rows (i.e. array size).
Note that query_sql runs on the main database while query_logsql runs on the log database.
set
.@nb,
query_sql
("SELECT name, fame FROM `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
mes
"Hall Of Fame: TOP5";
for
(
set
.@i,1; .@i <= .@nb; set .@i,.@i+1)
mes
.@i+". "+.@name$[0]+" ("+.@fame[0]+")"; // Will return a person with the biggest fame value.