Mysql Query Ambigous Option - HELP !

01/02/2013 05:39 xSanii#1
Guten morgen Epvp.

Ich bin grade dabei ein eigenes PvP-Ranking zu erstellen.

Die PHP dafür hab ich bereits funtionstüchtig fertig.

Jedoch funzt meine mysql funktion nicht richtig...

Code:
local spielerid= pc.get_player_id()
local update_kill_rot = mysql_query("UPDATE player.player SET red_kill="..pc.getqf("empire1").." WHERE id="..spielerid.."")
Code:
mysql: ambiguous option '--e=UPDATE player.player SET red_kill=6 WHERE id=57976' (enable_cleartext_plugin, execute)
ID und Killanzahl liest er wunderbar aus.

Nur setzt er die spalte dort nicht auf 6 wie es im Befehl steht.

Bitte um Hilfe !
Also bitte um Hilfe !
01/02/2013 09:39 iSouli~#2
Zeig mir mal deine mysql_query function. Ich glaube ich kenne den Fehler.
01/02/2013 12:15 xSanii#3
Quote:
Originally Posted by iSouli~ View Post
Zeig mir mal deine mysql_query function. Ich glaube ich kenne den Fehler.
Code:
--[[
    @name   mysql_query
    @author Mijago
    @needs  split
    @descr
Mysql-Funktion der neuesten Generation.
--]]
mysql_query = function(query)
    if not pre then
        local rt = io.open('CONFIG','r'):read('*all')
        pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4')
    end
    math.randomseed(os.time())
    local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}
    os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi)
    for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi);
    for i = 2, table.getn(t) do table.foreach(t[i],function(a,b)
        out[i-1]               = out[i-1] or {}
        out[i-1][a]            = tonumber(b) or b or 'NULL'
        out[t[1][a]]           = out[t[1][a]] or {}
        out[t[1][a]][i-1]      = tonumber(b) or b or 'NULL'
    end) end
    out.__lines = t[1]
    return out
end
Ganz normale von Mijago halt :D
01/02/2013 18:18 iSouli~#4
Quote:
Originally Posted by xSanii View Post
Code:
--[[
    @name   mysql_query
    @author Mijago
    @needs  split
    @descr
Mysql-Funktion der neuesten Generation.
--]]
mysql_query = function(query)
    if not pre then
        local rt = io.open('CONFIG','r'):read('*all')
        pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4')
    end
    math.randomseed(os.time())
    local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}
    os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi)
    for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) end; os.remove(fi);
    for i = 2, table.getn(t) do table.foreach(t[i],function(a,b)
        out[i-1]               = out[i-1] or {}
        out[i-1][a]            = tonumber(b) or b or 'NULL'
        out[t[1][a]]           = out[t[1][a]] or {}
        out[t[1][a]][i-1]      = tonumber(b) or b or 'NULL'
    end) end
    out.__lines = t[1]
    return out
end
Ganz normale von Mijago halt :D
Änder das --e=" in -e" dann sollte es wieder funktionieren.
01/03/2013 12:24 xSanii#5
Kann closed werden.

SoNiice hat mir bereits geholfen ;)