Xagul
deathzot.net
- Joined
- Jun 30, 2008
- Messages
- 1,295
- Solutions
- 3
- Reaction score
- 1,043
Hello, I am currently having some trouble with executing an SQL Query via talkaction. Basically this SQL Query is suppose to find everyone with x storagekey and order the value of that storagekey however when I test the script I get this:
It looks like it is ordering it in descending order but not properly because its reading the number from left to right and it needs to be reading it from right to left in order to properly sort the numbers by descending order.
Here is the script I am currently using, it would be great if anyone knows a way around this.
Code:
21:17 Descending Order:
2[9]
7[60]
6[19]
5[11]
It looks like it is ordering it in descending order but not properly because its reading the number from left to right and it needs to be reading it from right to left in order to properly sort the numbers by descending order.
Here is the script I am currently using, it would be great if anyone knows a way around this.
Code:
function onSay(cid, words, param, channel)
local list = db.getResult("SELECT `player_id`, `key`, `value` FROM `player_storage` WHERE `key` = 7214 ORDER BY `value` DESC LIMIT 0, 4;")
if(list:getID() ~= -1) then
local v = 'Descending Order:\n'
repeat
v = v .. list:getDataString("player_id") .. "[" .. list:getDataString("value") .. "]\n"
until not list:next()
list:free()
doBroadcastMessage(v, MESSAGE_STATUS_CONSOLE_RED)
end
return true
end