Ir para conteúdo
  • 0

erro com mysql ...


Maenilse

Pergunta

bom ontem eu tava com meu servidor ate umas 00:23 horas com sqlite. entao eu resolvi resetar e passa-lo para mysql. ate ai tudo bem. mas quando eu usava a talkaction de rank frags no meu sqlite funcionava. no mysql apresenta esse erro. como eu resolvo isso? nao manjo de mysql.

 

[26/08/2013 19:08:10] mysql_real_query(): SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 824544 ORDER BY cast(value as INTEGER) DESC; - MYSQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTEGER) DESC' at line 1 (1064)
Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

o thiago eu sem querer deletei a table player_storage e nao sei a query. poderia me passar tambem? seu script.

 

local config = {
MaxPlayer = 20,
fight_skills = {
        ['fist'] = 0,
        ['club'] = 1,
        ['sword'] = 2,
        ['axe'] = 3,
        ['distance'] = 4,
        ['shielding'] = 5,
        ['fishing'] = 6,
        ['dist'] = 4,
        ['shield'] = 5,
        ['fish'] = 6,
},
other_skills = {
[''] = "level",
['level'] = "level",
['magic'] = "maglevel",
['health'] = "healthmax",
['mana'] = "manamax"
},
vocations = {
['sorcerer'] = {1,5},
['druid'] = {2,6},
['paladin'] = {3,7},
['knight'] = {4,8}
},
storages = {
['frags'] = 824544,
['resets'] = 2310,
['points'] = 1219
}
}
function onSay(cid, words, param)
local param,str = string.lower(param),""
if not config.fight_skills[param] and not config.other_skills[param] and not config.vocations[param] and  not config.storages[param] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "este rank não existe.") return true
end
str = "--[ RANK "..(param == "" and "LEVEL" or string.upper(param)).." ]--\n\n"
query = config.fight_skills[param] and db.getResult("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = "..config.fight_skills[param].." ORDER BY `value` DESC;") or config.other_skills[param] and db.getResult("SELECT `name`, `"..config.other_skills[param].."` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `"..config.other_skills[param].."` DESC, `name` ASC;") or config.storages[param] and db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..config.storages[param].." ORDER BY cast(value as INTEGER) DESC;") or db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` <= 2 AND `vocation` = "..config.vocations[param][1].." or `vocation` = "..config.vocations[param][2].." ORDER BY `level` DESC;") 
if (query:getID() ~= -1) then 
k = 1 
while true do
str = str .. "\n " .. k .. ". "..(config.fight_skills[param] and getPlayerNameByGUID(query:getDataString("player_id")) or config.storages[param] and getPlayerNameByGUID(query:getDataString("player_id")) or query:getDataString("name")).." - [" .. query:getDataInt((config.fight_skills[param] and "value" or config.storages[param] and "value" or config.vocations[param] and "level" or config.other_skills[param])) .. "]"
k = k + 1
if not(query:next()) or k > config.MaxPlayer then
break 
end 
end 
query:free()
end
doShowTextDialog(cid,6500, str)
return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

pronto criolo, a mágica ta feita.

 

 

local config = {
MaxPlayer = 20,
fight_skills = {
        ['fist'] = 0,
        ['club'] = 1,
        ['sword'] = 2,
        ['axe'] = 3,
        ['distance'] = 4,
        ['shielding'] = 5,
        ['fishing'] = 6,
        ['dist'] = 4,
        ['shield'] = 5,
        ['fish'] = 6,
},
other_skills = {
[''] = "level",
['level'] = "level",
['magic'] = "maglevel",
['health'] = "healthmax",
['mana'] = "manamax"
},
vocations = {
['sorcerer'] = {1,5},
['druid'] = {2,6},
['paladin'] = {3,7},
['knight'] = {4,8}
},
storages = {
['frags'] = 824544,
['resets'] = 2310,
['points'] = 1219
}
}
function onSay(cid, words, param)
local param,str = string.lower(param),""
if not config.fight_skills[param] and not config.other_skills[param] and not config.vocations[param] and  not config.storages[param] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "este rank não existe.") return true
end
str = "--[ RANK "..(param == "" and "LEVEL" or string.upper(param)).." ]--\n\n"
query = config.fight_skills[param] and db.getResult("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = "..config.fight_skills[param].." ORDER BY `value` DESC;") or config.other_skills[param] and db.getResult("SELECT `name`, `"..config.other_skills[param].."` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `"..config.other_skills[param].."` DESC, `name` ASC;") or config.storages[param] and db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..config.storages[param].." ORDER BY cast(value as SIGNED) DESC;") or db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` <= 2 AND `vocation` = "..config.vocations[param][1].." or `vocation` = "..config.vocations[param][2].." ORDER BY `level` DESC;") 
if (query:getID() ~= -1) then 
k = 1 
while true do
str = str .. "\n " .. k .. ". "..(config.fight_skills[param] and getPlayerNameByGUID(query:getDataString("player_id")) or config.storages[param] and getPlayerNameByGUID(query:getDataString("player_id")) or query:getDataString("name")).." - [" .. query:getDataInt((config.fight_skills[param] and "value" or config.storages[param] and "value" or config.vocations[param] and "level" or config.other_skills[param])) .. "]"
k = k + 1
if not(query:next()) or k > config.MaxPlayer then
break 
end 
end 
query:free()
end
doShowTextDialog(cid,6500, str)
return true
end

---------------- a query q vc pediu

 

 

CREATE TABLE player_storage ( 
    player_id INTEGER         NOT NULL,
    [key]     INTEGER         NOT NULL,
    value     VARCHAR( 255 )  NOT NULL
                              DEFAULT '0',
    UNIQUE ( player_id, [key] ),
    FOREIGN KEY ( player_id ) REFERENCES players ( id ) 
);
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...